Title: "Go 1.11 module"
Date: 8-8-10-26t23: 50: 56 + 08: 00
Draft: false
---
Go 1.11 module Introduction
Go 1.11 released a new mode to manage the dependent libraries of Go programs. This method is different fromvendor
Model.
It provides the following important features:
- It is easier to work without gopath (I understand that gopath gradually fades out, And gopath once left a lot of pitfalls for beginners of golang)
- Use
$GOPATH/pkg/mod
To storego mod
Cache file to improvego get
Speed
- Optional
$GOPROXY
Interaction with goproxy
- Enterprise-level or LAN-level private
go mod
Server
- Is
golang.org/x/text
Provide cache and speed-up for third-party dependent Libraries
Enable
go mod
To enable go mod, You need to configureGO111MODULE
Environment variable:
GO111MODULE=off
No module support, go will$GOPATH
Andvendor
Folder to find the package.
GO111MODULE=on
Module support. Go ignores$GOPATH
Andvendor
Folder, onlygo.mod
Download dependencies.
GO111MODULE=auto
In$GOPATH/src
And the root directory hasgo.mod
File, enable module support.
Use goproxy
Here is an open-source version of goproxy. Io.
And its GitHub homepage github.com/goproxyio
Self-built goproxy Server
Athens is a server for your go packages
Project address https://github.com/gomods/athens
Athens can be used to establish private data within the company.go mod
Server,
Or create an external public networkGOPROXY server
.
Refer:
- Introduction to go modules
- Playing with Go module proxies
- Athens
Go 1.11 module Introduction