gin icon indicating copy to clipboard operation
gin copied to clipboard

'go get' is no longer supported outside a module.

Open orhan-cmd opened this issue 2 years ago • 5 comments

go get is no longer supported outside a module. therefore I changed go get to go install

orhan-cmd avatar Jul 21 '22 13:07 orhan-cmd

have u solve it? i get this problem too.

PS D:\Dev\go\spider> go install github.com/gin-gonic/gin@latest 
package github.com/gin-gonic/gin is not a main package

SnowingFox avatar Aug 06 '22 06:08 SnowingFox

@SnowingFox firstly get your version go version command, after that if your go >= 1.17

go install github.com/gin-gonic/gin@latest

go < 1.17

go get github.com/gin-gonic/gin

orhan-cmd avatar Aug 06 '22 06:08 orhan-cmd

@SnowingFox firstly get your version go version command, after that if your go >= 1.17

go install github.com/gin-gonic/gin@latest

go < 1.17

go get github.com/gin-gonic/gin

my go version is 1.19, i tried use go install, but it throw me an error, so i had to use go get, it download success

SnowingFox avatar Aug 06 '22 06:08 SnowingFox

Hey ,

Same issue here.

Have you find a way to make it work ?

/home/seb/sdk/go1.18.3/bin/go version
go version go1.18.3 linux/amd64
 /home/seb/sdk/go1.18.3/bin/go install github.com/gin-gonic/gin@latest
package github.com/gin-gonic/gin is not a main package

Thanks

SebastienTolron avatar Aug 10 '22 13:08 SebastienTolron

Hey ,

Same issue here.

Have you find a way to make it work ?

/home/seb/sdk/go1.18.3/bin/go version
go version go1.18.3 linux/amd64
 /home/seb/sdk/go1.18.3/bin/go install github.com/gin-gonic/gin@latest
package github.com/gin-gonic/gin is not a main package

Thanks

Hey, it seems like your error is related to your Go modules setup. Did you set up a new Go project with modules, before running the install gin-gonic command (go install github.com/gin-gonic/gin@latest)?

Try this StackOverflow answer to see if that helps your issue. In particular, see step 4: In the newly created folder run go mod init projectPath where projectPath should be the URL of your future git repo (e.g. github.com/myname/myproject).. Let me know if that doesn't work?

LinTrieu avatar Nov 22 '22 18:11 LinTrieu