mageextras

package module
v0.0.42 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: 0BSD Imports: 8 Imported by: 0

README

mage-extras: some predefined tasks for common mage workflows

go.dev reference Test license

SUMMARY

mage-extras streamlines common Go development tasks.

ABOUT

API Docs

mage-extras provides utility functions for common Go development operations.

Examples:

  • GoEnv - Query the go env toolchain configuration subsystem
  • Install - Compile and install Go executables
  • Lint Go projects recursively:
    • GoImports
    • GoVet
    • GoVetShadow
    • Nakedret
  • UnitTest - trigger unit test suite

SYSTEM REQUIREMENTS

For details on developing mage-extras, see our development guide.

Documentation

Overview

Package mageextras provides premade tasks for common mage workflows.

Index

Constants

This section is empty.

Variables

View Source
var CollectedGoFiles = make(map[string]bool)

CollectedGoFiles represents source and test Go files in a project. Populdated with CollectGoFiles().

View Source
var CollectedGoSourceFiles = make(map[string]bool)

CollectedGoSourceFiles represents the set of Go source files in a project. Populated with CollectGoFiles().

View Source
var CollectedGoTestFiles = make(map[string]bool)

CollectedGoTestFiles represents the set of Go test files in a project. Populdated with CollectGoFiles().

View Source
var GoListSourceFilesTemplate = "{{$p := .}}{{range $f := .GoFiles}}{{$p.Dir}}/{{$f}}\n{{end}}"

GoListSourceFilesTemplate provides a standard Go template for querying a project's Go source file paths.

View Source
var GoListTestFilesTemplate = "{{$p := .}}{{range $f := .XTestGoFiles}}{{$p.Dir}}/{{$f}}\n{{end}}"

GoListTestFilesTemplate provides a standard Go template for querying a project's Go test file paths.

View Source
var PathSeparatorString = string(os.PathSeparator)

PathSeparatorString models the os.PathSeparator as a string.

View Source
var Version = "0.0.42"

Version is semver.

Functions

func CollectGoFiles

func CollectGoFiles() error

CollectGoFiles populates CollectedGoFiles, CollectedGoSourceFiles, and CollectedGoTestFiles.

Vendored files are ignored.

func CoverageHTML

func CoverageHTML(htmlFilename string, profileFilename string) error

CoverageHTML generates HTML formatted coverage data.

func CoverageProfile

func CoverageProfile(profileFilename string) error

CoverageProfile generates raw coverage data.

func GoEnv added in v0.0.41

func GoEnv(key string) (string, error)

GoEnv queries the `go env` toolchain configuration system.

func GoImports

func GoImports(args ...string) error

GoImports runs goimports.

func GoVet

func GoVet(args ...string) error

GoVet runs go vet against all Go packages in a project.

func GoVetShadow

func GoVetShadow() error

GoVetShadow runs go vet against all Go packages in a project, with variable shadow checking enabled.

Depends on golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow

func Install

func Install(args ...string) error

Install builds and installs Go applications.

func Nakedret

func Nakedret(args ...string) error

Nakedret runs nakedret.

func Uninstall

func Uninstall(applications ...string) error

Uninstall deletes installed Go applications.

func UnitTest

func UnitTest(args ...string) error

UnitTest executes the Go unit test suite.

Types

This section is empty.

Jump to

Keyboard shortcuts

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