How to install a package in Go via go get: command not working or deprecated?
Hello everyone! I just started learning Go, and I have a problem with installing third-party packages. I read old articles where everyone simply wrote go get github.com/some/package, and the package was immediately downloaded to $GOPATH. But I have Go 1.16+, and the go get command behaves strangely.
Here's what I'm doing. I have a simple project in the folder /home/user/myproject:
// main.go\npackage main\n\nimport "github.com/gin-gonic/gin"\n\nfunc main() {\n r := gin.Default()\n r.GET("/", func(c *gin.Context) {\n c.JSON(200, gin.H{"message": "hello"})\n })\n r.Run()\n}\n\n\nI run go get github.com/gin-gonic/gin, but in the console I see a warning:
go: 'go get' is not a standard com