commands

package
v0.0.100 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoModDropReplace

func GoModDropReplace(modulePath string, opts *GoModEditOptions) error

GoModDropReplace executes "go mod edit -dropreplace" to remove a replacement directive

func GoModEditReplace

func GoModEditReplace(modulePath, replacement string, opts *GoModEditOptions) error

GoModEditReplace executes "go mod edit -replace" to add a replacement directive

func GoModEditRequire

func GoModEditRequire(modulePath, version string, opts *GoModEditOptions) error

GoModEditRequire executes "go mod edit -require" to update module version

func GoModTidy

func GoModTidy(opts *GoModEditOptions) error

GoModTidy executes "go mod tidy" in the specified directory

func GoToolNM

func GoToolNM(binary string) (string, error)

GoToolNM executes "go tool nm" on the specified binary

func GoToolObjdump

func GoToolObjdump(args ...string) (string, error)

GoToolObjdump executes "go tool objdump" with the specified arguments

Types

type GoMod

type GoMod struct {
	Module struct {
		Path string `json:"Path"`
	} `json:"Module"`
	Require []struct {
		Path    string `json:"Path"`
		Version string `json:"Version"`
	} `json:"Require"`
	Replace []struct {
		Old struct {
			Path string `json:"Path"`
		} `json:"Old"`
		New struct {
			Path    string `json:"Path"`
			Version string `json:"Version"`
		} `json:"New"`
	} `json:"Replace"`
}

GoMod represents the structure returned by "go mod edit -json"

func GoModEditJSON

func GoModEditJSON(opts *GoModEditOptions) (*GoMod, error)

GoModEditJSON executes "go mod edit -json" and returns the parsed module information

type GoModEditOptions

type GoModEditOptions struct {
	Dir    string // Working directory for the command
	Stderr bool   // Whether to show stderr output
	Stdout bool   // Whether to show stdout output
}

GoModEditOptions represents options for go mod edit commands

func DefaultGoModEditOptions

func DefaultGoModEditOptions() *GoModEditOptions

DefaultGoModEditOptions returns default options for go mod edit commands

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL