2020-10-13 03:14:03 +02:00
|
|
|
The Go programming language is an open source project to make
|
|
|
|
programmers more productive. Go is expressive, concise, clean,
|
|
|
|
and efficient. Its concurrency mechanisms make it easy to write
|
|
|
|
programs that get the most out of multicore and networked machines,
|
|
|
|
while its novel type system enables flexible and modular program
|
|
|
|
construction. Go compiles quickly to machine code yet has the
|
|
|
|
convenience of garbage collection and the power of run-time
|
|
|
|
reflection. It's a fast, statically typed, compiled language that
|
|
|
|
feels like a dynamically typed, interpreted language.
|
2012-05-13 15:04:29 +02:00
|
|
|
|
|
|
|
The tools are added to the path by putting go.sh and go.csh files in
|
2020-10-13 03:14:03 +02:00
|
|
|
/etc/profile.d and letting the system's /etc/profile or /etc/csh.login
|
|
|
|
pick it up. If you want to add any of Go's environment variables you
|
|
|
|
can add them there.
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
Also, to easily setup a user-independent path for Go libraries to
|
|
|
|
be installed to and used, is the GOPATH environment variable. This
|
|
|
|
variable can be colon delimited. For example, once installing the
|
|
|
|
built google-go-lang package, then set in your user's ~/.bashrc
|
|
|
|
something like:
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2017-10-30 13:21:58 +01:00
|
|
|
export GOPATH="$HOME"
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
Then, you'll be able to use the `go` command to install an additional
|
|
|
|
library that will not need root permission and will be in the
|
|
|
|
compiler's path. Like so:
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2017-10-30 13:21:58 +01:00
|
|
|
go get golang.org/x/tools/cmd/godoc
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
Now in ~/src you'll have this source code checked-out, and a binary
|
|
|
|
built at ~/bin/godoc
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
Since the golang idiom is very `go get'able as a limited user,
|
|
|
|
installed libraries from slackbuilds.org are located outside of GOROOT
|
|
|
|
(which is only for golang standard library), in /usr/share/gocode By
|
|
|
|
not setting a system-wide GOPATH defaulting to this location, then
|
|
|
|
it is up to the user of whether to include this system path as well,
|
|
|
|
like:
|
2013-01-05 19:45:29 +01:00
|
|
|
|
2017-10-30 13:21:58 +01:00
|
|
|
export GOPATH="$HOME:/usr/share/gocode"
|
2014-01-30 10:40:32 +01:00
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
This system source directory is primarly only for buildtime of
|
|
|
|
slackbuilds.
|
2014-01-30 10:40:32 +01:00
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
This is because `go get' iterates through the paths provided, looking
|
|
|
|
for matching imports. If a match is not found, then is cloned to the
|
|
|
|
first path provided. You would not want this to be a system path, as
|
|
|
|
to need root privilege to clone source.
|
2014-01-30 10:40:32 +01:00
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
As of go1.2, the 'go doc ...' command has been relocated to the
|
|
|
|
go.tools library (golang-googlecode-gotools), which provide `godoc`.
|
2014-10-30 21:48:13 +01:00
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
As of go1.5, shared libraries are now supported. The flags to use
|
|
|
|
linking are available for `go get`, `go install` and `go build`.
|
2016-02-29 23:18:42 +01:00
|
|
|
To learn more see `go help buildmode`.
|
|
|
|
|
2020-10-13 03:14:03 +02:00
|
|
|
To elect to run the buildtime tests of this package, provide the
|
|
|
|
environment variable RUN_TEST=true at build time.
|