Skip to content

Commit 2c78edd

Browse files
authored
Update information about GOPROXY, GOSUMDB, GOTOOLCHAIN (#491)
Revised information about goproxy and gotoolchain environment variables. Added information on gosumdb. All 3 variables are changed from default values in Fedora go.
1 parent 6302159 commit 2c78edd

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

tech/languages/go/go-installation.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,43 @@ Writing Go programs is covered in [Go programs](/tech/languages/go/go-programs.h
4646

4747
## Fedora Specific Notes
4848

49-
The default installation of Go on Fedora contains two changes that Go developers should be aware of.
49+
The default installation of Go on Fedora contains changes to the default values of `GOPROXY`, `GOSUMDB`, and `GOTOOLCHAIN` environment variables that Go developers should be aware of. The `go` command and related tools make extensive use of environment variables for configuration. Default values are set globally in `/usr/lib/golang/go.env`, and can be overridden on per user or per project basis.
50+
51+
For extensive help and information see:
52+
53+
```console
54+
$ go help environment
55+
```
5056

5157
### GOPROXY
5258

53-
The value of `GOPROXY` in `$GOROOT/go.env` is set to `direct`. A value of `direct` disables access to the module mirror. See [https://proxy.golang.org](https://proxy.golang.org) for more information on `GOPROXY` and the module mirror. A project specifc `go.env` can override this setting.
59+
The value of `GOPROXY` in `$GOROOT/go.env` is set to `direct`. A value of `direct` disables access to the module mirror. See [https://proxy.golang.org](https://proxy.golang.org) for more information on `GOPROXY` and the module mirror. A project specific `go.env` can override this setting. A user specific override can be set with:
60+
61+
```console
62+
$ go env -w GOPROXY=https://proxy.golang.org,direct
63+
```
64+
65+
### GOSUMDB
66+
67+
The value of `GOSUMDB` in `$GOROOT/go.env` is set to `off` replacing the default value of `sum.golang.org`. The GOSUMDB environment variable identifies the name of the checksum database used to help validate downloaded modules. A project specific `go.env` can override this setting. A user specific override can be set with:
68+
69+
```console
70+
$ go env -w GOSUMDB=sum.golang.org
71+
```
5472

5573
### GOTOOLCHAIN
5674

57-
Go 1.21 introduces `GOTOOLCHAIN` which facilitates project specific choices for the Go language toolchain of compiler, standard library, assembler, and other tools. The value of `GOTOOLCHAIN` is set to `local` instead of the default `auto`. See the [Go Toolchain](https://go.dev/doc/toolchain) documentation for more information on toolchains in Go and the implications of using `local` as the default. A project specific `go.env` file can override this setting.
75+
Go 1.21 introduces `GOTOOLCHAIN` which facilitates project specific choices for the Go language toolchain of compiler, standard library, assembler, and other tools. The value of `GOTOOLCHAIN` is set to `local` instead of the default `auto`. When GOTOOLCHAIN is set to local, the go command always runs the bundled Go toolchain. See the [Go Toolchain](https://go.dev/doc/toolchain) documentation for more information on toolchains in Go. A project specific `go.env` file can override this setting. A user specific override can be set with:
76+
77+
```console
78+
$ go env -w GOTOOLCHAIN=auto
79+
```
5880

5981

6082
## References
6183

6284
- [Go Documentation](https://golang.org/doc/)
85+
- [Go Environment Variables](https://pkg.go.dev/cmd/go#hdr-Environment_variables)
6386
- [Go Module Proxy](https://proxy.golang.org)
87+
- [GOSUMDB Environment](https://goproxy.io/docs/GOSUMDB-env.html)
6488
- [Go Toolchain](https://go.dev/doc/toolchain)

0 commit comments

Comments
 (0)