Go 1.11 module Introduction

Source: Internet
Author: User

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 fromvendorModel.

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/modTo storego modCache file to improvego getSpeed
  • Optional$GOPROXYInteraction with goproxy
    • Enterprise-level or LAN-level privatego modServer
    • Isgolang.org/x/textProvide cache and speed-up for third-party dependent Libraries
Enable go mod

To enable go mod, You need to configureGO111MODULEEnvironment variable:

  • GO111MODULE=offNo module support, go will$GOPATHAndvendorFolder to find the package.
  • GO111MODULE=onModule support. Go ignores$GOPATHAndvendorFolder, onlygo.modDownload dependencies.
  • GO111MODULE=autoIn$GOPATH/srcAnd the root directory hasgo.modFile, 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 modServer,
Or create an external public networkGOPROXY server.

Refer:

  • Introduction to go modules
  • Playing with Go module proxies
  • Athens

Go 1.11 module Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.