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, execute go env GO111MODULE and the result is on), 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
    

Reference

[1] Go Modules Reference

Copyright © 2019-2021 go-zero all right reserved,powered by GitbookLast UpdateTime: 2021-12-05 09:48:50

results matching ""

    No results matching ""