How to use GoLand ide go mod to build a project


No matter what programming language you learn, there are four steps you will go through at the beginning

  • Development tools installation
  • IDE installation
  • Set dependency / package image
  • Project building tools, managing dependencies / packages

1、 Installation of golang development tools Official website (need respective means) GitHub address Golang Chinese website

2、 GoLand ide installation

3、 Set dependency / package image


Common image address:

Alibaba cloud:
Qi niuyun:

4、 Project building tools, managing dependencies / packages

Reference article

An introduction to the relationship among root, gopath and go modules

1. In go.mod Chinese Editor


go.mod You can write the following keywords:

  • module

Define module path

  • go

Define go language version

  • require

Specify the dependent suite. The default is the latest version. You can specify the version number

  • exclude

Exclude the kit and its version

  • replace

Use a different KIT version and replace the original kit version annotation
//Single line annotation
/*Multiline annotation*/
Indirect represents the dependency package that is indirectly imported

2. Command line go get address

go get

As long as it’s opengo modulesFunction,go getIt’s not going to be like beforeGOPATH/srcThe package file will be placed in theGOPATH/pkg/modInside, andgo.modI will write the introduction, so I don’t need to use itgo mod downloaThe D command is out.


Here is the article about how to use Golan ide go mod to build a project. For more information about Golan ide go mod, please search previous articles of developer or continue to browse the following articles. I hope you can support developer more in the future!