modified for go1.13.1

apparluk 2019-10-16 22:27:15 +02:00
parent 79ef87f7f2
commit e491b7850f

@ -1,8 +1,8 @@
This wiki page documents the file tree for a source installation of go1.9.2 to which have been added the github.com/golang blog, net and tools sub-repositories, and the github.com/gonum/gonum repository. It is somewhat consistent with the file tree of the golang.org/dl pre-compiled downloads for GNU/Linux. It presumes the reader is familiar with utilisation of $GOPATH on Un*x as a colon-separated string; GNU/Linux being a multi-user OS the added sub-repositories and repository are located in $HOME/go and /usr/share/gocode. This page documents the file tree for a source installation of go1.13.1.
``` ```
% tree -d -L 2 /usr/lib/go1.9.2 | head $ tree -d -L 2 /usr/lib/go1.13.1 | head
/usr/lib/go1.9.2 /usr/lib/go1.13.1
`-- go `-- go
|-- api |-- api
|-- bin |-- bin
@ -12,26 +12,27 @@ This wiki page documents the file tree for a source installation of go1.9.2 to w
|-- pkg |-- pkg
|-- src |-- src
`-- test `-- test
% $
``` ```
api contains data for Go's API checker api contains data for Go's API checker
``` ```
% ls $GOROOT/api $ ls $GOROOT/api
README go1.1.txt go1.3.txt go1.5.txt go1.7.txt go1.9.txt next.txt README go1.10.txt go1.13.txt go1.4.txt go1.7.txt go1.txt
except.txt go1.2.txt go1.4.txt go1.6.txt go1.8.txt go1.txt except.txt go1.11.txt go1.2.txt go1.5.txt go1.8.txt next.txt
% go1.1.txt go1.12.txt go1.3.txt go1.6.txt go1.9.txt
$
``` ```
bin contains the go and gofmt executables bin contains the go and gofmt executables
``` ```
% ls -l $GOROOT/bin $ ls -l $GOROOT/bin
total 7588 total 11576
-rwxr-xr-x 1 root root 5918348 Oct 31 16:06 go -rwxr-xr-x 1 root root 9652760 Oct 2 03:02 go
-rwxr-xr-x 1 root root 1831140 Oct 31 16:06 gofmt -rwxr-xr-x 1 root root 2197756 Oct 2 03:02 gofmt
% $
``` ```
doc contains .css, .go, .html, .js, and .png files doc contains .css, .go, .html, .js, and .png files
@ -39,89 +40,46 @@ doc contains .css, .go, .html, .js, and .png files
lib contains the compressed time zone database lib contains the compressed time zone database
``` ```
% tree $GOROOT/lib | head -n 5 $ tree $GOROOT/lib | head -n 5
/usr/lib/go1.9.2/go/lib /usr/lib/go1.13.1/go/lib
`-- time `-- time
|-- README |-- README
|-- update.bash |-- update.bash
`-- zoneinfo.zip `-- zoneinfo.zip
% $
``` ```
misc/android contains information on development for android<br/> misc contains files pertaining to specific build modes and platforms
misc/arm contains a script for executing go binaries on android<br/>
misc/cgo contains tests and examples of cgo<br/>
misc/chrome contains a Chrome extension<br/>
misc/git contains a pre-commit hook<br/>
misc/ios contains information on cross compiling for iOS<br/>
misc/linkcheck contains a program checking links on the godoc website<br/>
misc/nacl contains Go's integration with nacl, used by the Go playground<br/>
misc/sortac contains a utility for sorting the AUTHORS and CONTRIBUTORS files<br/>
misc/swig contains examples of using Go with SWIG<br/>
misc/trace contains a generated file used by go tool trace
``` ```
% tree -d -L 1 $GOROOT/misc | head -n 12 $ tree -d -L 1 $GOROOT/misc | head -n 12
/usr/lib/go1.9.2/go/misc /usr/lib/go1.13.1/go/misc
|-- android |-- android
|-- arm |-- arm
|-- cgo |-- cgo
|-- chrome |-- chrome
|-- git
|-- ios |-- ios
|-- linkcheck |-- linkcheck
|-- nacl |-- nacl
|-- sortac |-- reboot
|-- swig |-- swig
`-- trace |-- trace
% `-- wasm
$
``` ```
pkg contains libs, header files, compiled object files, and executables pkg contains libs, header files, compiled object files, and executables
``` ```
% tree -d -L 1 $GOROOT/pkg | head -n 7 $ tree -d -L 1 $GOROOT/pkg | head -n 6
/usr/lib/go1.9.2/go/pkg /usr/lib/go1.13.1/go/pkg
|-- bootstrap
|-- include |-- include
|-- linux_386 |-- linux_386
|-- linux_386_dynlink |-- linux_386_dynlink
|-- obj |-- obj
`-- tool `-- tool
% $
``` ```
src contains the go1.13.1 source code
test contains tests of the Go tool chain and runtime test contains tests of the Go toolchain and runtime
The github.com/golang net and tools sub-repositories and github.com/gonum/gonum repository can be located in /usr/share/gocode, utilising the following commands.
```
% su -c tcsh
Password:
# setenv GOPATH /usr/share/gocode
# go get -u golang.org/x/tools/...
# go get -u gonum.org/v1/gonum/...
# find $GOPATH -print0 | xargs -0 file | grep "executable" | grep ELF \
? | cut -f 1 -d : | xargs strip --strip-unneeded
# exit
%
```
To compile Go code with the libraries in /usr/share/gocode you must add the location to $GOPATH.
```
% setenv GOPATH $HOME/go:/usr/share/gocode
% go get -u golang.org/x/blog
package golang.org/x/blog: no Go files in /home/eric/go/src/golang.org/x/blog
% cd go/src/golang.org/x/blog/blog
% go build
% mv blog $HOME/go/bin
%
```
This page utilises the C shell as [SettingGOPATH](https://github.com/golang/go/wiki/SettingGOPATH) doesn't include that shell.
For information on running the blog server see [Go Blog](https://github.com/golang/blog); those instructions might be more comprehensive being edited, but for Un*x just omit the .exe
file extension.
See also: [Modules](https://github.com/golang/go/wiki/modules)