package modcmd

import "cmd/go/internal/modcmd"

Package modcmd implements the “go mod” command.

Index

Variables

var CmdMod = &base.Command{
	UsageLine: "go mod",
	Short:     "module maintenance",
	Long:      "" /* 316 byte string literal not displayed */,

	Commands: []*base.Command{
		cmdDownload,
		cmdEdit,
		cmdGraph,
		cmdInit,
		cmdTidy,
		cmdVendor,
		cmdVerify,
		cmdWhy,
	},
}

Functions

func DownloadModule

func DownloadModule(ctx context.Context, m *ModuleJSON) error

DownloadModule runs 'go mod download' for m.Path@m.Version, leaving the results (including any error) in m itself.

func RunVendor

func RunVendor(ctx context.Context, vendorE bool, vendorO string, args []string)

Types

type ModuleJSON

type ModuleJSON struct {
	Path     string `json:",omitempty"`
	Version  string `json:",omitempty"`
	Query    string `json:",omitempty"`
	Error    string `json:",omitempty"`
	Info     string `json:",omitempty"`
	GoMod    string `json:",omitempty"`
	Zip      string `json:",omitempty"`
	Dir      string `json:",omitempty"`
	Sum      string `json:",omitempty"`
	GoModSum string `json:",omitempty"`

	Origin *codehost.Origin `json:",omitempty"`
	Reuse  bool             `json:",omitempty"`
}

A ModuleJSON describes the result of go mod download.

Source Files

download.go edit.go graph.go init.go mod.go tidy.go vendor.go verify.go why.go

Version
v1.24.0 (latest)
Published
Feb 10, 2025
Platform
linux/amd64
Imports
31 packages
Last checked
25 minutes ago

Tools for package owners.