If you cd into src/hello then run: go install hello
does that work for you? I believe it will work from anywhere in the file system. It should just be looking for the relative path from your go src directory.
No, the doc is correct. It states that you should be running the following: go install github.com/user/hello
This is based on the step where it mentioned creating the directory structure “src/github.com/user/hello”. It looks for the package location starting from “$GOPATH/src”.
Your GOPATH is set to “$HOME/Development/golang”, then within the directory “golang” you should have three more directories: src, bin, pkg
When you type in go install src/hello/hello.go, you’re telling it to look in $GOPATH/src/src/hello/hello.go. So the first issue is that is will have src in the path it’s looking for twice, which won’t work since that path doesn’t exist. The second issue is that you only need to type in the package name (“hello”) and not the source code’s file name. Go will compile the files inside for you. If you want to build using filenames, you can cd into the directory holding your ‘.go’ files to use go build, and as christophberger mentioned, it will compile it and drop it in that same directory.
Hope that all made sense. Also, You may want to stick with using the suggested directory structure of $GOPATH/src/github.com/github_username. It will make things easier to manage down the road.