Version: v0.0.0-...-3f8d162 Latest Latest

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

Go to latest
Published: Jun 25, 2022 License: Apache-2.0 Imports: 9 Imported by: 0



Package gocmd provides helers for invoking Go tooling.



This section is empty.


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


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 ListModDirName

func ListModDirName(dir string) (string, error)

ListModDirName finds the directory in which the module resides. Returns ErrBuildConstraint if all files in a module are constrained.

func ListModName

func ListModName(dir string) (string, error)

ListModName finds a modules name for a given directory.

func ModInit

func ModInit(dir, importPath 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.


This section is empty.

Source Files

Jump to

Keyboard shortcuts

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