gocmd

package
v0.0.0-...-31558c7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gocmd provides helers for invoking Go tooling.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBuildConstraint is returned when the Go command returns this error.
	ErrBuildConstraint error = errors.New("build constraints exclude all Go files")
)

Functions

func Build

func Build(dir string) error

Build attempts to build all packages recursively from the given directory.

func CurrentMod

func CurrentMod(dir string) (string, error)

CurrentMod returns the module name of the provided directory.

func EditReplace

func EditReplace(dir, mod, modPath string) error

EditReplace edits a module dependency with a local reference.

func ListModName

func ListModName(dir string) (string, error)

ListModName finds a module's name for a given directory.

func ModInit

func ModInit(dir, importPath, goVersion string) error

ModInit creates a new module in the specified directory.

func ModTidy

func ModTidy(dir string) error

ModTidy tidies go.mod file in the specified directory.

func ModTidyAll

func ModTidyAll(dir string) error

ModTidyAll tidies all mod files from the specified root directory.

func Vet

func Vet(dir string) error

Vet runs linters on all .go files recursively from the given directory.

func WorkUse

func WorkUse(dir string) error

WorkUse updates the go.work file for added modules.

Types

This section is empty.

Jump to

Keyboard shortcuts

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