Skip to content
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

Closed
matthewvcarey1 opened this issue Nov 21, 2018 · 6 comments
Closed

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

matthewvcarey1 opened this issue Nov 21, 2018 · 6 comments
Labels
Documentation FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@matthewvcarey1
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

(People who like this bug also like #18119)

@bradfitz bradfitz changed the title The introductory documentation page assumes GOPATH is not a list doc: code.html page assumes GOPATH is not a list Nov 21, 2018
@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Nov 21, 2018
@bradfitz bradfitz added this to the Go1.13 milestone Nov 21, 2018
@ghost
Copy link

ghost 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

@ghost
Copy link

ghost 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.

@agnivade
Copy link
Contributor

/cc @bcmills for decision.

@bcmills
Copy link
Contributor

bcmills commented Feb 27, 2019

At this point I don't think it's worth the effort to update all of our tutorial content work with multiple-element GOPATHs: the use-cases for them are specific to GOPATH mode and will hopefully go away soon anyway (#30228, #4719).

@bcmills bcmills closed this as completed Feb 27, 2019
@golang golang locked and limited conversation to collaborators Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants