Go Module Configuration
[!TIP] This document is machine-translated by Google. If you find grammatical and semantic errors, and the document description is not clear, please PR
Introduction to Go Module
Modules are how Go manages dependencies.[1]
That is, Go Module is a way for Golang to manage dependencies, similar to Maven in Java and Gradle in Android.
Module configuration
- Check the status of
GO111MODULE
$ go env GO111MODULE
on
- Turn on
GO111MODULE
, if it is already turned on (that is, executego env GO111MODULE
and the result ison
), please skip it.$ go env -w GO111MODULE="on"
- Set up
GOPROXY
$ go env -w GOPROXY=https://goproxy.cn
Set up
GOMODCACHE
view
GOMODCACHE
$ go env GOMODCACHE
If the directory is not empty or
/dev/null
, please skip it.go env -w GOMODCACHE=$GOPATH/pkg/mod