diff --git a/README.md b/README.md index 49231bf25d..4ca3956de8 100644 --- a/README.md +++ b/README.md @@ -19,22 +19,20 @@ BSD-style license found in the LICENSE file. Official binary distributions are available at https://golang.org/dl/. After downloading a binary release, visit https://golang.org/doc/install -or load [doc/install.html](./doc/install.html) in your web browser for installation -instructions. +for installation instructions. #### Install From Source If a binary distribution is not available for your combination of operating system and architecture, visit -https://golang.org/doc/install/source or load [doc/install-source.html](./doc/install-source.html) -in your web browser for source installation instructions. +https://golang.org/doc/install/source +for source installation instructions. ### Contributing Go is the work of thousands of contributors. We appreciate your help! -To contribute, please read the contribution guidelines: - https://golang.org/doc/contribute.html +To contribute, please read the contribution guidelines at https://golang.org/doc/contribute.html. Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of diff --git a/doc/install-source.html b/doc/install-source.html deleted file mode 100644 index f0a909263c..0000000000 --- a/doc/install-source.html +++ /dev/null @@ -1,777 +0,0 @@ - - -
-Go is an open source project, distributed under a -BSD-style license. -This document explains how to check out the sources, -build them on your own machine, and run them. -
- --Most users don't need to do this, and will instead install -from precompiled binary packages as described in -Getting Started, -a much simpler process. -If you want to help develop what goes into those precompiled -packages, though, read on. -
- -
-There are two official Go compiler toolchains.
-This document focuses on the gc
Go
-compiler and tools.
-For information on how to work on gccgo
, a more traditional
-compiler using the GCC back end, see
-Setting up and using gccgo.
-
-The Go compilers support the following instruction sets: - -
amd64
, 386
-x86
instruction set, 64- and 32-bit.
-arm64
, arm
-ARM
instruction set, 64-bit (AArch64
) and 32-bit.
-mips64
, mips64le
, mips
, mipsle
-MIPS
instruction set, big- and little-endian, 64- and 32-bit.
-ppc64
, ppc64le
-riscv64
-s390x
-wasm
--The compilers can target the AIX, Android, DragonFly BSD, FreeBSD, -Illumos, Linux, macOS/iOS (Darwin), NetBSD, OpenBSD, Plan 9, Solaris, -and Windows operating systems (although not all operating systems -support all architectures). -
- --A list of ports which are considered "first class" is available at the -first class ports -wiki page. -
- --The full set of supported combinations is listed in the -discussion of environment variables below. -
- --See the main installation page for the overall system requirements. -The following additional constraints apply to systems that can be built only from source: -
- -
-The Go toolchain is written in Go. To build it, you need a Go compiler installed.
-The scripts that do the initial build of the tools look for a "go" command
-in $PATH
, so as long as you have Go installed in your
-system and configured in your $PATH
, you are ready to build Go
-from source.
-Or if you prefer you can set $GOROOT_BOOTSTRAP
to the
-root of a Go installation to use to build the new Go toolchain;
-$GOROOT_BOOTSTRAP/bin/go
should be the go command to use.
-There are four possible ways to obtain a bootstrap toolchain: -
- --These approaches are detailed below. -
- --To use a binary release as a bootstrap toolchain, see -the downloads page or use any other -packaged Go distribution. -
- -
-To cross-compile a bootstrap toolchain from source, which is
-necessary on systems Go 1.4 did not target (for
-example, linux/ppc64le
), install Go on a different system
-and run bootstrap.bash.
-
-When run as (for example) -
- --$ GOOS=linux GOARCH=ppc64 ./bootstrap.bash -- -
-bootstrap.bash
cross-compiles a toolchain for that GOOS/GOARCH
-combination, leaving the resulting tree in ../../go-${GOOS}-${GOARCH}-bootstrap
.
-That tree can be copied to a machine of the given target type
-and used as GOROOT_BOOTSTRAP
to bootstrap a local build.
-
-To use gccgo as the bootstrap toolchain, you need to arrange
-for $GOROOT_BOOTSTRAP/bin/go
to be the go tool that comes
-as part of gccgo 5. For example on Ubuntu Vivid:
-
-$ sudo apt-get install gccgo-5 -$ sudo update-alternatives --set go /usr/bin/go-5 -$ GOROOT_BOOTSTRAP=/usr ./make.bash -- -
-To build a bootstrap toolchain from C source code, use
-either the git branch release-branch.go1.4
or
-go1.4-bootstrap-20171003.tar.gz,
-which contains the Go 1.4 source code plus accumulated fixes
-to keep the tools running on newer operating systems.
-(Go 1.4 was the last distribution in which the toolchain was written in C.)
-After unpacking the Go 1.4 source, cd
to
-the src
subdirectory, set CGO_ENABLED=0
in
-the environment, and run make.bash
(or,
-on Windows, make.bat
).
-
-Once the Go 1.4 source has been unpacked into your GOROOT_BOOTSTRAP directory,
-you must keep this git clone instance checked out to branch
-release-branch.go1.4
. Specifically, do not attempt to reuse
-this git clone in the later step named "Fetch the repository." The go1.4
-bootstrap toolchain must be able to properly traverse the go1.4 sources
-that it assumes are present under this repository root.
-
-Note that Go 1.4 does not run on all systems that later versions of Go do. -In particular, Go 1.4 does not support current versions of macOS. -On such systems, the bootstrap toolchain must be obtained using one of the other methods. -
- -
-To perform the next step you must have Git installed. (Check that you
-have a git
command before proceeding.)
-
-If you do not have a working Git installation, -follow the instructions on the -Git downloads page. -
- -
-To build a Go installation
-with cgo
support, which permits Go
-programs to import C libraries, a C compiler such as gcc
-or clang
must be installed first. Do this using whatever
-installation method is standard on the system.
-
-To build without cgo
, set the environment variable
-CGO_ENABLED=0
before running all.bash
or
-make.bash
.
-
Change to the directory where you intend to install Go, and make sure
-the goroot
directory does not exist. Then clone the repository
-and check out the latest release tag (go1.12
,
-for example):
-$ git clone https://go.googlesource.com/go goroot
-$ cd goroot
-$ git checkout <tag>
-
-
-
-Where <tag>
is the version string of the release.
-
Go will be installed in the directory where it is checked out. For example,
-if Go is checked out in $HOME/goroot
, executables will be installed
-in $HOME/goroot/bin
. The directory may have any name, but note
-that if Go is checked out in $HOME/go
, it will conflict with
-the default location of $GOPATH
.
-See GOPATH
below.
-Reminder: If you opted to also compile the bootstrap binaries from source (in an
-earlier section), you still need to git clone
again at this point
-(to checkout the latest <tag>
), because you must keep your
-go1.4 repository distinct.
-
If you intend to modify the go source code, and -contribute your changes -to the project, then move your repository -off the release branch, and onto the master (development) branch. -Otherwise, skip this step.
- --$ git checkout master -- -
-To build the Go distribution, run -
- --$ cd src -$ ./all.bash -- -
-(To build under Windows use all.bat
.)
-
-If all goes well, it will finish by printing output like: -
- --ALL TESTS PASSED - ---- -Installed Go for linux/amd64 in /home/you/go. -Installed commands in /home/you/go/bin. -*** You need to add /home/you/go/bin to your $PATH. *** -- -
-where the details on the last few lines reflect the operating system, -architecture, and root directory used during the install. -
- -
-For more information about ways to control the build, see the discussion of
-environment variables below.
-all.bash
(or all.bat
) runs important tests for Go,
-which can take more time than simply building Go. If you do not want to run
-the test suite use make.bash
(or make.bat
)
-instead.
-
-Check that Go is installed correctly by building a simple program. -
- -
-Create a file named hello.go
and put the following program in it:
-
-package main - -import "fmt" - -func main() { - fmt.Printf("hello, world\n") -} -- -
-Then run it with the go
tool:
-
-$ go run hello.go -hello, world -- -
-If you see the "hello, world" message then Go is installed correctly. -
- --You're almost done. -You just need to do a little more setup. -
- -- -How to Write Go Code -Learn how to set up and use the Go tools - -
- --The How to Write Go Code document -provides essential setup instructions for using the Go tools. -
- - -
-The source code for several Go tools (including godoc)
-is kept in the go.tools repository.
-To install one of the tools (godoc
in this case):
-
-$ go get golang.org/x/tools/cmd/godoc -- -
-To install these tools, the go
get
command requires
-that Git be installed locally.
-
-You must also have a workspace (GOPATH
) set up;
-see How to Write Go Code for the details.
-
-The usual community resources such as
-#go-nuts
on the Freenode IRC server
-and the
-Go Nuts
-mailing list have active developers that can help you with problems
-with your installation or your development work.
-For those who wish to keep up to date,
-there is another mailing list, golang-checkins,
-that receives a message summarizing each checkin to the Go repository.
-
-Bugs can be reported using the Go issue tracker. -
- - -
-New releases are announced on the
-golang-announce
-mailing list.
-Each announcement mentions the latest release tag, for instance,
-go1.9
.
-
-To update an existing tree to the latest release, you can run: -
- -
-$ cd go/src
-$ git fetch
-$ git checkout <tag>
-$ ./all.bash
-
-
-
-Where <tag>
is the version string of the release.
-
-The Go compilation environment can be customized by environment variables. -None is required by the build, but you may wish to set some -to override the defaults. -
- -$GOROOT
-
-The root of the Go tree, often $HOME/go1.X
.
-Its value is built into the tree when it is compiled, and
-defaults to the parent of the directory where all.bash
was run.
-There is no need to set this unless you want to switch between multiple
-local copies of the repository.
-
$GOROOT_FINAL
-
-The value assumed by installed binaries and scripts when
-$GOROOT
is not set explicitly.
-It defaults to the value of $GOROOT
.
-If you want to build the Go tree in one location
-but move it elsewhere after the build, set
-$GOROOT_FINAL
to the eventual location.
-
$GOPATH
-
-The directory where Go projects outside the Go distribution are typically
-checked out. For example, golang.org/x/tools
might be checked out
-to $GOPATH/src/golang.org/x/tools
. Executables outside the
-Go distribution are installed in $GOPATH/bin
(or
-$GOBIN
, if set). Modules are downloaded and cached in
-$GOPATH/pkg/mod
.
-
The default location of $GOPATH
is $HOME/go
,
-and it's not usually necessary to set GOPATH
explicitly. However,
-if you have checked out the Go distribution to $HOME/go
,
-you must set GOPATH
to another location to avoid conflicts.
-
$GOBIN
-
-The directory where executables outside the Go distribution are installed
-using the go command. For example,
-go get golang.org/x/tools/cmd/godoc
downloads, builds, and
-installs $GOBIN/godoc
. By default, $GOBIN
is
-$GOPATH/bin
(or $HOME/go/bin
if GOPATH
-is not set). After installing, you will want to add this directory to
-your $PATH
so you can use installed tools.
-
-Note that the Go distribution's executables are installed in
-$GOROOT/bin
(for executables invoked by people) or
-$GOTOOLDIR
(for executables invoked by the go command;
-defaults to $GOROOT/pkg/$GOOS_GOARCH
) instead of
-$GOBIN
.
-
$GOOS
and $GOARCH
-
-The name of the target operating system and compilation architecture.
-These default to the values of $GOHOSTOS
and
-$GOHOSTARCH
respectively (described below).
-
-Choices for $GOOS
are
-android
, darwin
, dragonfly
,
-freebsd
, illumos
, ios
, js
,
-linux
, netbsd
, openbsd
,
-plan9
, solaris
and windows
.
-
-Choices for $GOARCH
are
-amd64
(64-bit x86, the most mature port),
-386
(32-bit x86), arm
(32-bit ARM), arm64
(64-bit ARM),
-ppc64le
(PowerPC 64-bit, little-endian), ppc64
(PowerPC 64-bit, big-endian),
-mips64le
(MIPS 64-bit, little-endian), mips64
(MIPS 64-bit, big-endian),
-mipsle
(MIPS 32-bit, little-endian), mips
(MIPS 32-bit, big-endian),
-s390x
(IBM System z 64-bit, big-endian), and
-wasm
(WebAssembly 32-bit).
-
-The valid combinations of $GOOS
and $GOARCH
are:
-
$GOOS | $GOARCH |
-|
---|---|---|
aix | ppc64 |
-|
android | 386 |
-|
android | amd64 |
-|
android | arm |
-|
android | arm64 |
-|
darwin | amd64 |
-|
darwin | arm64 |
-|
dragonfly | amd64 |
-|
freebsd | 386 |
-|
freebsd | amd64 |
-|
freebsd | arm |
-|
illumos | amd64 |
-|
ios | arm64 |
-|
js | wasm |
-|
linux | 386 |
-|
linux | amd64 |
-|
linux | arm |
-|
linux | arm64 |
-|
linux | ppc64 |
-|
linux | ppc64le |
-|
linux | mips |
-|
linux | mipsle |
-|
linux | mips64 |
-|
linux | mips64le |
-|
linux | riscv64 |
-|
linux | s390x |
-|
netbsd | 386 |
-|
netbsd | amd64 |
-|
netbsd | arm |
-|
openbsd | 386 |
-|
openbsd | amd64 |
-|
openbsd | arm |
-|
openbsd | arm64 |
-|
plan9 | 386 |
-|
plan9 | amd64 |
-|
plan9 | arm |
-|
solaris | amd64 |
-|
windows | 386 |
-|
windows | amd64 |
-
$GOHOSTOS
and $GOHOSTARCH
--The name of the host operating system and compilation architecture. -These default to the local system's operating system and -architecture. -
-
-Valid choices are the same as for $GOOS
and
-$GOARCH
, listed above.
-The specified values must be compatible with the local system.
-For example, you should not set $GOHOSTARCH
to
-arm
on an x86 system.
-
$GO386
(for 386
only, defaults to sse2
)
--This variable controls how gc implements floating point computations. -
-GO386=softfloat
: use software floating point operations; should support all x86 chips (Pentium MMX or later).GO386=sse2
: use SSE2 for floating point operations; has better performance but only available on Pentium 4/Opteron/Athlon 64 or later.$GOARM
(for arm
only; default is auto-detected if building
-on the target processor, 6 if not)
--This sets the ARM floating point co-processor architecture version the run-time -should target. If you are compiling on the target system, its value will be auto-detected. -
-GOARM=5
: use software floating point; when CPU doesn't have VFP co-processorGOARM=6
: use VFPv1 only; default if cross compiling; usually ARM11 or better cores (VFPv2 or better is also supported)GOARM=7
: use VFPv3; usually Cortex-A cores-If in doubt, leave this variable unset, and adjust it if required -when you first run the Go executable. -The GoARM page -on the Go community wiki -contains further details regarding Go's ARM support. -
-$GOMIPS
(for mips
and mipsle
only) $GOMIPS64
(for mips64
and mips64le
only)
-
- These variables set whether to use floating point instructions. Set to "hardfloat
" to use floating point instructions; this is the default. Set to "softfloat
" to use soft floating point.
-
$GOPPC64
(for ppc64
and ppc64le
only)
-
-This variable sets the processor level (i.e. Instruction Set Architecture version)
-for which the compiler will target. The default is power8
.
-
GOPPC64=power8
: generate ISA v2.07 instructionsGOPPC64=power9
: generate ISA v3.00 instructions$GOWASM
(for wasm
only)
- - This variable is a comma separated list of experimental WebAssembly features that the compiled WebAssembly binary is allowed to use. - The default is to use no experimental features. -
-GOWASM=satconv
: generate saturating (non-trapping) float-to-int conversionsGOWASM=signext
: generate sign-extension operators
-Note that $GOARCH
and $GOOS
identify the
-target environment, not the environment you are running on.
-In effect, you are always cross-compiling.
-By architecture, we mean the kind of binaries
-that the target environment can run:
-an x86-64 system running a 32-bit-only operating system
-must set GOARCH
to 386
,
-not amd64
.
-
-If you choose to override the defaults,
-set these variables in your shell profile ($HOME/.bashrc
,
-$HOME/.profile
, or equivalent). The settings might look
-something like this:
-
-export GOARCH=amd64 -export GOOS=linux -- -
-although, to reiterate, none of these variables needs to be set to build, -install, and develop the Go tree. -
diff --git a/doc/install.html b/doc/install.html deleted file mode 100644 index 706d66c007..0000000000 --- a/doc/install.html +++ /dev/null @@ -1,315 +0,0 @@ - - -- -Download Go -Click here to visit the downloads page - -
- -
-Official binary
-distributions are available for the FreeBSD (release 10-STABLE and above),
-Linux, macOS (10.11 and above), and Windows operating systems and
-the 32-bit (386
) and 64-bit (amd64
) x86 processor
-architectures.
-
-If a binary distribution is not available for your combination of operating -system and architecture, try -installing from source or -installing gccgo instead of gc. -
- - --Go binary distributions are available for these supported operating systems and architectures. -Please ensure your system meets these requirements before proceeding. -If your OS or architecture is not on the list, you may be able to -install from source or -use gccgo instead. -
- -Operating system | -Architectures | -Notes | -
---|---|---|
FreeBSD 10.3 or later | amd64, 386 | Debian GNU/kFreeBSD not supported |
Linux 2.6.23 or later with glibc | amd64, 386, arm, arm64, s390x, ppc64le | CentOS/RHEL 5.x not supported. Install from source for other libc. |
macOS 10.11 or later | amd64 | use the clang or gcc† that comes with Xcode‡ for cgo support |
Windows 7, Server 2008R2 or later | amd64, 386 | use MinGW (386 ) or MinGW-W64 (amd64 ) gcc†.No need for cygwin or msys. |
-†A C compiler is required only if you plan to use
-cgo.
-‡You only need to install the command line tools for
-Xcode. If you have already
-installed Xcode 4.3+, you can install it from the Components tab of the
-Downloads preferences panel.
-
-If you are upgrading from an older version of Go you must -first remove the existing version. -
- -
-Download the archive
-and extract it into /usr/local
, creating a Go tree in
-/usr/local/go
. For example:
-
-tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
-
-
-
-Choose the archive file appropriate for your installation.
-For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux,
-the archive you want is called go1.2.1.linux-amd64.tar.gz
.
-
-(Typically these commands must be run as root or through sudo
.)
-
-Add /usr/local/go/bin
to the PATH
environment
-variable. You can do this by adding this line to your /etc/profile
-(for a system-wide installation) or $HOME/.profile
:
-
-export PATH=$PATH:/usr/local/go/bin -- -
-Note: changes made to a profile
file may not apply until the
-next time you log into your computer.
-To apply the changes immediately, just run the shell commands directly
-or execute them from the profile using a command such as
-source $HOME/.profile
.
-
-Download the package file,
-open it, and follow the prompts to install the Go tools.
-The package installs the Go distribution to /usr/local/go
.
-
-The package should put the /usr/local/go/bin
directory in your
-PATH
environment variable. You may need to restart any open
-Terminal sessions for the change to take effect.
-
-The Go project provides two installation options for Windows users -(besides installing from source): -a zip archive that requires you to set some environment variables and an -MSI installer that configures your installation automatically. -
- -
-Open the MSI file
-and follow the prompts to install the Go tools.
-By default, the installer puts the Go distribution in c:\Go
.
-
-The installer should put the c:\Go\bin
directory in your
-PATH
environment variable. You may need to restart any open
-command prompts for the change to take effect.
-
-Download the zip file and extract it into the directory of your choice (we suggest c:\Go
).
-
-Add the bin
subdirectory of your Go root (for example, c:\Go\bin
) to your PATH
environment variable.
-
-Under Windows, you may set environment variables through the "Environment -Variables" button on the "Advanced" tab of the "System" control panel. Some -versions of Windows provide this control panel through the "Advanced System -Settings" option inside the "System" control panel. -
- --Check that Go is installed correctly by building a simple program, as follows. -
- -
-Create a file named hello.go
that looks like:
-
-package main - -import "fmt" - -func main() { - fmt.Printf("hello, world\n") -} -- -
-Then build it with the go
tool:
-
-$ go build hello.go -- -
-C:\Users\Gopher\go\src\hello> go build hello.go -- -
-The command above will build an executable named
-hello
hello.exe
-in the current directory alongside your source code.
-Execute it to see the greeting:
-
-$ ./hello -hello, world -- -
-C:\Users\Gopher\go\src\hello> hello -hello, world -- -
-If you see the "hello, world" message then your Go installation is working. -
- --Before rushing off to write Go code please read the -How to Write Go Code document, -which describes some essential concepts about using the Go tools. -
- - --It may be useful to have multiple Go versions installed on the same machine, for -example, to ensure that a package's tests pass on multiple Go versions. -Once you have one Go version installed, you can install another (such as 1.10.7) -as follows: -
- --$ go get golang.org/dl/go1.10.7 -$ go1.10.7 download -- -
-The newly downloaded version can be used like go
:
-
-$ go1.10.7 version -go version go1.10.7 linux/amd64 -- -
-All Go versions available via this method are listed on
-the download page.
-You can find where each of these extra Go versions is installed by looking
-at its GOROOT
; for example, go1.10.7 env GOROOT
.
-To uninstall a downloaded version, just remove its GOROOT
directory
-and the goX.Y.Z
binary.
-
-To remove an existing Go installation from your system delete the
-go
directory. This is usually /usr/local/go
-under Linux, macOS, and FreeBSD or c:\Go
-under Windows.
-
-You should also remove the Go bin
directory from your
-PATH
environment variable.
-Under Linux and FreeBSD you should edit /etc/profile
or
-$HOME/.profile
.
-If you installed Go with the macOS package then you
-should remove the /etc/paths.d/go
file.
-Windows users should read the section about setting
-environment variables under Windows.
-
- For help, see the list of Go mailing lists, forums, and places to chat. -
- -
- Report bugs either by running “go
bug
”, or
- manually at the Go issue tracker.
-