I have been having this issue of setting up my workspace for a while now. I have two values in my GOPATH. They are C:\Users\Me\Documents\gocodes\ and C:\Users\Me\Documents\gocodes\src\github.com\dan-osineye\ “so I have my project saved here”. When I do the go run for my .go file it runs and I get a good result, but that is almost useless. The image shows my what I have been going through for days now. Really frustrating.
I’d appreciate a step by step procedure, I don’t mind reinstalling go all over. I don’t mind having a session with a pro. Or is Windows awkward for go?
If C:\Users\DANNY\Documents\gocodes will be that folder then do the following.
Set this environmental variable GOPATH=C:\Users\DANNY\Documents\gocodes
Then at the end of your PATH variable add this: %GOPATH%\bin
Now close down all your terminal windows and restart a new one
Navigate to the gocodes folder
Add a single folder called src
I would remove anything else that may exist inside of gocodes. Make a backup of that.
execute the go env command from the terminal and you should see your Go env show up. Check that the GOPATH variable is set with your full gocodes folder
The src folder begins your go workspace. This is where you want to work from. To test things, we can go get something.
It is best to start new projects with a repo first and to clone that repo inside your Go workspace but any folder inside the src folder is enough to get started.