Reputation: 533
I have installed the go language in my ubuntu using sudo apt install golang-go
.
It was successfully installed. When i run go version
I am getting go version go1.10.4 linux/amd64
but when i tried running go mod init projectName
I am getting the following error go: unknown subcommand "mod"
Do I need to install mod package or am i missing something? I have implemented the solution given by christophe in this forum but it didn't work for me.
Upvotes: 10
Views: 27835
Reputation: 705
Because preliminary support for go-modules came in version 1.11 and 1.12.
I suggest that you install using the linux build directly from golang
Upvotes: 1
Reputation: 418435
Preliminary module support was added in Go 1.11, so Go 1.10 knows no mod
subcommand.
You need to install a newer, preferably the newest 1.14 version of Go. Get it from the official downloads page. Go 1.10 is not even supported anymore (doesn't receive security patches).
The prepared packages of OSes usually lag behind new releases. I'd advise to always get Go from the official page.
Upvotes: 19