golang

package
v0.0.0-...-e2ae3e1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UpdatePackage  = sh.RunCmd("go", "get", "-u")
	InstallPackage = sh.RunCmd("go", "install")
	Mod            = sh.RunCmd("go", "mod")
)

Functions

func EnsureBranchInPackage

func EnsureBranchInPackage(pkg string, branchName string) error

EnsureBranchInPackage ensures that a specific branch is checked out in a Go package.

pkg: the path to the Go package. branchName: the name of the branch to ensure.

error: an error if there was a problem ensuring the branch.

func EnsureBranchInPackageCmd

func EnsureBranchInPackageCmd(pkg string, branchName string) magelib.Cmd

EnsureBranchInPackageCmd returns a function that ensures a specific branch is checked out in a Go package.

pkg: the path to the Go package. branchName: the name of the branch to ensure.

magelib.Cmd: a function that returns an error if there was a problem ensuring the branch.

func EnsurePackageInstalledCmd

func EnsurePackageInstalledCmd(appName string, packageName string) magelib.Cmd

func Env

func Env(value string) (string, error)

Env returns the value of the specified golang environment variable.

value: the name of the environment variable to retrieve. string: the value of the environment variable, or an empty string if it is undefined. error: any error that occurred while retrieving the environment variable value.

func InGoPackageDir

func InGoPackageDir(pkg string, fn func() error) error

InGoPackageDir executes a function within the directory of a Go package in GOPATH.

pkg: the name of the Go package. fn: the function to be executed within the package directory. error: any error that occurred during execution.

func InstallPackageCmd

func InstallPackageCmd(packageName string) magelib.Cmd

func IsPackageClean

func IsPackageClean(pkg string) error

IsPackageClean checks if a Go package has unstaged files that have been changed in repo or staged files have been modified in repo or repo is not in sync with the remote repo

path is the path to the repository. status is the status information of the repository. Returns an error if the repository status is not valid, otherwise nil.

func IsPackageCleanCmd

func IsPackageCleanCmd(pkg string) magelib.Cmd

IsPackageCleanCmd returns a function that checks if a Go package is clean.

pkg: the path to the Go package. magelib.Cmd: a function that returns an error if the package is not clean.

func ModTidyCmd

func ModTidyCmd() magelib.Cmd

func PackageDir

func PackageDir(pkg string) (string, error)

PackageDir returns the directory path of a Go package in GOPATH.

pkg: the name of the Go package. string: the directory path of the Go package. error: any error that occurred while retrieving the directory path.

func UpdateGoModule

func UpdateGoModule(path string, vendor bool) error

UpdateGoModule updates the Go module at the specified path.

path: the directory path where the Go module is located. vendor: a boolean indicating whether to vendor the dependencies.

error: an error if the update operation fails.

func UpdateModuleCmd

func UpdateModuleCmd(path string, vendor bool) magelib.Cmd

UpdateModuleCmd returns a command that updates the Go module at the specified path.

path: the directory path where the Go module is located. vendor: a boolean indicating whether to vendor the dependencies.

magelib.Cmd: a command that updates the Go module.

func UpdatePackageCmd

func UpdatePackageCmd(packageName string) magelib.Cmd

Types

This section is empty.

Jump to

Keyboard shortcuts

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