mageutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GocovTool               = "gocov"
	GocovXMLTool            = "gocov-xml"
	GolangciLintTool        = "golangci-lint"
	EditorconfigCheckerTool = "editorconfig-checker"
	GoLicenseTool           = "go-licenses"
	GoStringerTool          = "stringer"
)
View Source
const (
	// MageColorEnableEnvVar is the environment variable that enables color in mage.
	MageColorEnableEnvVar = "MAGEFILE_ENABLE_COLOR"
)

The most reliable way to pass data to go tests is through environment variables. This file contains the environment variables used by the magefiles and understood by the tests.

Variables

View Source
var (
	ErrCmdLookup = errors.New("command lookup error")
	ErrDir       = errors.New("directory error")
	ErrFile      = errors.New("file error")
)

Functions

func AzldevProjectDir

func AzldevProjectDir() string

func BinDir

func BinDir() string

func BuildDir

func BuildDir() string

func CreateBinDir

func CreateBinDir() error

func CreateBuildDir

func CreateBuildDir() error

func CreateLicenseDir

func CreateLicenseDir() error

func CreateOutDir

func CreateOutDir() error

func GetToolAbsPath

func GetToolAbsPath(toolName string) (toolPath string, err error)

GetToolAbsPath returns the command to run a go tool that is managed within one of the tools-focused modules in this repository.

func LicenseDir

func LicenseDir() string

func MagePrintf

func MagePrintf(msgType MessageType, text string, args ...interface{})

MagePrintf prints a message with a message type and formatted text.

func MagePrintln

func MagePrintln(msgType MessageType, a ...any)

MagePrintln prints a message with a message type and text without formatting.

func OutDir

func OutDir() string

func PrintAndReturnError

func PrintAndReturnError(text string, generalError, specificError error) error

PrintAndReturnError prints an error message, then returns a wrapped error. generalError should usually be a step error (e.g., ErrCheck, ErrBuild, etc.), while specificError should be the error that caused the step error (e.g., file not found, etc.). If specificError is nil, generalError is returned without wrapping.

i.e., PrintAndReturnError("Can't do step", "step failed", "file not found"):

prints "Can't do step" returns error("step failed: file not found")

PrintAndReturnError("Can't do step", "step failed", nil):

prints "Can't do step" returns error("step failed").

func ScenarioDir

func ScenarioDir() string

Types

type MessageType

type MessageType int
const (
	MsgStart MessageType = iota
	MsgInfo
	MsgWarning
	MsgError
	MsgSuccess
)

Jump to

Keyboard shortcuts

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