use go module

Enable go module in vscode.

    "editor.fontSize": 18,
    "extensions.ignoreRecommendations": false,
    "java.errors.incompleteClasspath.severity": "ignore",
    "editor.fontLigatures": true,
    "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "alt",
    "editor.formatOnPaste": true,
    "rust.mode": "legacy",
    "workbench.colorTheme": "Sublime MavensMate Monokai",
    "workbench.iconTheme": "eq-material-theme-icons",
    "materialTheme.fixIconsRunning": false,
    "[python]": {
    "workbench.fontAliasing": "auto",
    "go.formatTool": "goimports",
    "go.useLanguageServer": true,
    "go.toolsManagement.autoUpdate": true,
    "go.toolsEnvVars": {
        "GO111MODULE": "on"

Init the root module

$ go mod init


go 1.16

Get the dependency package

go get
go: downloading v1.5.2
go: downloading v1.3.0
go: downloading v0.0.0-20170915032832-14c0d48ead0c
go get: added v1.5.2

list all dependency

go list -m all v0.0.0-20170915032832-14c0d48ead0c v1.5.2 v1.3.0

Upgrade one dependency

@MacBook-Pro ~/D/C/g/go-module> go get
go get: upgraded v0.0.0-20170915032832-14c0d48ead0c => v0.3.6

go get[email protected]
go: downloading v1.3.1
go get: upgraded v1.2.1 => v1.3.1

Remove unused dependency

@MacBook-Pro ~/D/C/g/go-module> go mod tidy

Leave a Reply

Your email address will not be published. Required fields are marked *