mage

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// GoImportsImportPath controls the import path used to install goimports.
	GoImportsImportPath = "golang.org/x/tools/cmd/goimports"

	// GoImportsLocalPrefix is a string prefix matching imports that should be
	// grouped after third-party packages.
	GoImportsLocalPrefix = "github.com/elastic"
)

Variables

View Source
var (
	// GoLicenserImportPath controls the import path used to install go-licenser.
	GoLicenserImportPath = "github.com/elastic/go-licenser"

	// GoNoticeGeneratorImportPath controls the import path used to install go-licence-detector.
	GoNoticeGeneratorImportPath = "go.elastic.co/go-licence-detector"
)

Functions

func CheckNoChanges added in v0.2.1

func CheckNoChanges() error

func FindFilesRecursive added in v0.2.12

func FindFilesRecursive(match func(path string, info os.FileInfo) bool) ([]string, error)

FindFilesRecursive recursively traverses from the CWD and invokes the given match function on each regular file to determine if the given path should be returned as a match. It ignores files in .git directories.

func GenerateNotice added in v0.2.0

func GenerateNotice(overrides, rules, noticeTemplate string) error

func GitDiff added in v0.2.1

func GitDiff() error

GitDiff runs 'git diff' and writes the output to stdout.

func GitDiffIndex added in v0.2.1

func GitDiffIndex() ([]string, error)

GitDiffIndex returns a list of files that differ from what is committed. These could file that were created, deleted, modified, or moved.

func InstallGoLicenser added in v0.2.0

func InstallGoLicenser() error

InstallGoLicenser target installs go-licenser

func InstallGoNoticeGen added in v0.2.0

func InstallGoNoticeGen() error

InstallGoLicenser target installs go-licenser

Types

type Benchmark added in v0.3.5

type Benchmark mg.Namespace

Benchmark namespace for mage to group all the related targets under this namespace

func (Benchmark) Deps added in v0.3.5

func (Benchmark) Deps() error

Deps installs required plugins for reading benchmarks results

func (Benchmark) Diff added in v0.3.5

func (Benchmark) Diff() error

Diff parse one or more benchmark outputs, Required environment variables are BASE for parsing results and NEXT to compare the base results with. Optional you can define OUTPUT to write the results into a file

func (Benchmark) Run added in v0.3.5

func (Benchmark) Run() error

Run execute the go benchmark tests for this repository, by defining the variable OUTPUT you write the results into a file. Optional you can set BENCH_COUNT to how many benchmark iteration you want to execute, default is 8

type Deps

type Deps mg.Namespace

Deps contains targets related to checking dependencies

func (Deps) CheckModuleTidy

func (Deps) CheckModuleTidy() error

CheckModuleTidy checks if `go mod tidy` was run before the last commit.

type GoImports added in v0.2.12

type GoImports mg.Namespace

Linter contains targets related to linting the Go code

func (GoImports) Install added in v0.2.12

func (GoImports) Install() error

func (GoImports) Run added in v0.2.12

func (GoImports) Run() error

Run executes goimports against all .go files in and below the CWD.

type Linter

type Linter mg.Namespace

Linter contains targets related to linting the Go code

func (Linter) All

func (l Linter) All() error

All runs the linter against the entire codebase

func (Linter) CheckConfig

func (Linter) CheckConfig() error

CheckConfig makes sure that the `.golangci.yml` does not have uncommitted changes

func (Linter) ForceInstall added in v0.2.10

func (Linter) ForceInstall() error

ForceInstall force installs the linter regardless of whether it exists or not.

func (Linter) Install

func (Linter) Install() error

Install installs golangci-lint (https://golangci-lint.run) to `./build` using the official installation script downloaded from GitHub. If the linter binary already exists does nothing.

func (Linter) LastChange

func (l Linter) LastChange() error

LastChange runs the linter against all files changed since the fork point from `main`. If the current branch is `main` then runs against the files changed in the last commit.

func (Linter) Version added in v0.2.11

func (l Linter) Version() error

Prints the version of the linter in use.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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