golang

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllCommandsPath = strings.Join([]string{".", "cmd", "..."}, PathSeparatorString)

AllCommandsPath denotes all Go application packages in this project.

View Source
var AllPackagesPath = "." + PathSeparatorString + "..."

AllPackagesPath denotes all Go packages in a project.

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.

Functions

func Build

func Build(name, packageName, version string, opts ...BuildOption) func() error

Build the given binary using the given package.

func CollectGoFiles

func CollectGoFiles() error

CollectGoFiles populates CollectedGoFiles, CollectedGoSourceFiles, and CollectedGoTestFiles.

Vendored files are ignored.

func Format

func Format() error

Format all source code.

func Generate

func Generate(name, packageName string) func() error

Generate invoke the go:generate task on given package

func Import

func Import() error

Import fix all source code imports.

func IntegrationTest

func IntegrationTest(packageName string) func() error

IntegrationTest run go test

func Is added in v0.1.11

func Is(constraints ...string) bool

Is return true if current go version is included in given array.

func License

func License(basePath string) func() error

License checks allowed license of vendored dependencies.

func Lint

func Lint(basePath string) func() error

Lint all source code.

func Release

func Release(name, packageName, version string, opts ...BuildOption) func() error

Release build and generate a final release artifact.

func UnitTest

func UnitTest(packageName string) func() error

UnitTest run go test

func Vendor

func Vendor() error

Vendor locks all dependencies.

Types

type BuildOption

type BuildOption func(*buildOpts)

BuildOption is used to define function option pattern.

func GOARCH

func GOARCH(value string) BuildOption

GOARCH sets the GOARCH value during build

func GOARM

func GOARM(value string) BuildOption

GOARM sets the GOARM value during build

func GOOS

func GOOS(value string) BuildOption

GOOS sets the GOOS value during build

func WithCGO

func WithCGO() BuildOption

WithCGO enables CGO compilation

func WithPIE

func WithPIE() BuildOption

WithPIE enables Position Independent Executable compilation

Jump to

Keyboard shortcuts

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