New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: code.html page assumes GOPATH is not a list #28905

Open
matthewvcarey1 opened this Issue Nov 21, 2018 · 4 comments

Comments

Projects
None yet
5 participants
@matthewvcarey1

matthewvcarey1 commented Nov 21, 2018

What version of Go are you using (go version)?

$ go version
go version go1.4.3 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GOARCH="amd64"
GOBIN="/home/matthew/go/bin"
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/matthew/go:/usr/share/go1.4/contrib"
GORACE=""
GOROOT="/usr/lib64/go1.4"
GOTOOLDIR="/usr/lib64/go1.4/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

cat /etc/issue
Welcome to openSUSE Tumbleweed 20181103

What did you do?

Use the documentation page https://golang.org/doc/code.html to try and set up and use go
to run initial examples

The documentation assumes that the go env GOPATH returns a single path not a list of paths.

go env GOPATH
/home/matthew/go:/usr/share/go1.4/contrib

This means that passages like this do not work.

To compile and run a simple program, first choose a package path (we'll use github.com/user/hello) > and create a corresponding package directory inside your workspace:

$ mkdir $GOPATH/src/github.com/user/hello

An obvious workaround in my case is to use sed but it would make the documentation page less readable.

$ mkdir $(echo "$GOPATH" | sed 's/:.*//g')src/github.com/user/hello

What did you expect to see?

What did you see instead?

@agnivade

This comment has been minimized.

Member

agnivade commented Nov 21, 2018

The documentation explicitly mentions how to set a GOPATH here - https://golang.org/doc/code.html#GOPATH and goes forward with that assumption.

Technically, the documentation is correct in that regard.

Maybe we can add another line saying that GOPATH can have multiple values. But given the fact that we are sunsetting GOPATH, I wouldn't worry about adding further corner cases to it.

@bradfitz

This comment has been minimized.

Member

bradfitz commented Nov 21, 2018

(People who like this bug also like #18119)

@bradfitz bradfitz changed the title from The introductory documentation page assumes GOPATH is not a list to doc: code.html page assumes GOPATH is not a list Nov 21, 2018

@bradfitz bradfitz added this to the Go1.13 milestone Nov 21, 2018

@forskning

This comment has been minimized.

forskning commented Nov 27, 2018

This is originally (some later modifications added) of what I wanted a Wiki page to look like.

https://nurmi-labs.blogspot.com/p/filetreedoc.html

@forskning

This comment has been minimized.

forskning commented Nov 28, 2018

R.C. once wrote about something like $GOROOT/HACKING.md (to match src/runtime/HACKING.md and maybe others), maybe such (circa 2017) consideration should be revisited, as that content could go in such an .md file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment