What should be the values of GOPATH and GOROOT in Go? Proper environment setup
Hello everyone! I just started learning Go and immediately ran into confusion. I installed Go using the official installer on Windows, but then I read that I need to set the GOPATH and GOROOT environment variables. Honestly, I don't understand why they are needed and what values to put there.\n\nI tried running a simple code:\n\n```go\npackage main\n\nimport "fmt"\n\nfunc main() {\n fmt.Println("Hello, Go!")\n}\n```\n\nAt first, I just opened the terminal, navigated to the folder with the main.go file, and typed `go run main.go`. The code ran, and I thought everything was working. But then I tried to install a third-party package using `go get github.com/gin-gonic/gin` and got an error saying it couldn't find GOPATH. Online, people say different things: some say GOPATH should point to my working folder, others say I need to create
No answers yet.
Log in to leave an answer