golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.24k stars 17.57k forks source link

wiki: FileTree and SettingGOPATH #34853

Closed ghost closed 4 years ago

ghost commented 4 years ago

I would like to shorten (change) the name of the FileTreeDocumentation page to FileTree (this would affect the URL).

Regarding the SettingGOPATH page, the user customisation file .profile is used by all Bourne (and related) shells, so I don't know why .bash_profile is presented in an example instead of .profile.

In legacy code typically a Bourne compatible shell and the C shell are used in examples, so the information on fish and the Z shell seems in my view superfluous.

Basic information on GOPATH is accessible by typing go help gopath.

bash-4.3$ go help gopath | head -n 7
The Go path is used to resolve import statements.
It is implemented by and documented in the go/build package.

The GOPATH environment variable lists places to look for Go code.
On Unix, the value is a colon-separated string.
On Windows, the value is a semicolon-separated string.
On Plan 9, the value is a list.
bash-4.3$ 

The value is unset, but a default is encoded in the go compiler.

($HOME/go on Unix, %USERPROFILE%\go on Windows, and $home/go on Plan 9)

NB: The root of the Go tree cannot be included as a value in the Go path.

It might be considered favourable to distinguish between login and interactive shells.

.profile versus .bashrc .login versus .cshrc

I think that (in the 'Unix systems' section) shell script examples .sh and .csh might be added where the GOPATH value "is a colon-separated string", and where the reader of the wiki page is informed that these could be sourced during (and active for the duration of) a specific shell session.

Essentially, the renamed to FileTree page could be rewritten for Go 1.13 (preferably 64 bit) using bash, and some of its current information on $GOPATH and Golang sub-repositories could be shifted over to the SettingGOPATH page.

Factually it might make sense to rename the FileTreeDocumentation page to GoTree.

katiehockman commented 4 years ago

It looks like there are a number of proposed wiki changes in this issue, it may be easier to discuss these in separate issues, but I'll let @andybons weigh in.

andybons commented 4 years ago

As @katiehockman said, there's a lot going on, here. Best would be to start a conversation on golang-dev@ and/or file separate issues.