20

Why can't I find the version of go on my ubuntu 14.04? The output of go version doesn't give me info on whether the go is 1.7 or 1.8. Any ideas?

$ go version
go version xgcc (Ubuntu 4.9.3-0ubuntu4) 4.9.3 linux/amd64
$ uname -a
Linux jin1-hp1 3.19.0-65-generic #73~14.04.1-Ubuntu SMP Wed Jun 29 21:05:22 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Following another post, I found it from the command of docker, but I would like to find the version from go command itself.

$ docker version
Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:47:50 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
packetie
  • 4,839
  • 8
  • 37
  • 72

1 Answers1

10

Perhaps write a small program to print runtime.Version() ?

captncraig
  • 22,118
  • 17
  • 108
  • 151
  • I got the same resultl when printing `runtime.Version()`: `$ go run te.go xgcc (Ubuntu 4.9.3-0ubuntu4) 4.9.3` – packetie May 07 '17 at 13:54
  • 2
    There is no need to write the small program to get the version of `go` what you can do is that go to the terminal in ubuntu and run command `go version` and you would receive the version of your go. `go version go1.10.4 linux/amd64` Also, for new comers, if you are writing the small program don't forget to add import of `runtime` package. Cheers – Sunil Kumar Apr 04 '20 at 08:58