LinuxCommandLibrary

go-mod

Go module dependency management

TLDR

Initialize new module

$ go mod init [module-name]
copy
Download dependencies
$ go mod download
copy
Tidy dependencies
$ go mod tidy
copy
Vendor dependencies
$ go mod vendor
copy
Verify checksums
$ go mod verify
copy

SYNOPSIS

go mod command [arguments]

DESCRIPTION

go mod manages Go modules, the official dependency management system for Go. Modules are collections of packages with versioned dependencies defined in go.mod files.
The command initializes modules, manages dependencies, and maintains reproducible builds. It integrates with module proxies and checksum databases to ensure package integrity and availability.

PARAMETERS

init NAME

Initialize new module.
download
Download modules to cache.
tidy
Add missing, remove unused.
vendor
Create vendor directory.
verify
Verify dependencies.
graph
Print dependency graph.
why PACKAGE
Explain why needed.
--help
Display help information.

CONFIGURATION

go.mod

Module definition file containing module path, Go version, and dependency requirements.
go.sum
Checksums of module dependencies for verification.
GONOSUMCHECK
Environment variable to skip checksum verification for specific modules.
GOFLAGS
Default flags applied to go commands, including go mod subcommands.

CAVEATS

Requires Go 1.11+. go.sum should be committed. Vendor mode for offline builds.

HISTORY

Go modules were introduced in Go 1.11 as the official dependency management solution, replacing GOPATH-based workflows.

SEE ALSO

go(1), go-get(1)

> TERMINAL_GEAR

Curated for the Linux community

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99
Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

$1,589.00
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99
nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

$129.95
Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99