lib

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCmd

func AddCmd(cmd Cmd)

func BundleFile

func BundleFile(loc string, dist Distribution, config BuildConfig) (err error)

func CleanDirGlob

func CleanDirGlob(dir, pattern string) error

func Execute

func Execute() (err error)

func GetAliases

func GetAliases(availableDistributions DistributionSet) (aliases map[string]DistributionSet)

Compute aliases based on the available distributions

func RenderString

func RenderString(tmpl *template.Template, data interface{}) (string, error)

func StringCut

func StringCut(val string, sep string) (left, right string, found bool)

func StringCutAny

func StringCutAny(val string, seperators ...string) (left, right string, found bool)

func StringSliceContains

func StringSliceContains(s []string, key string) bool

func StringSliceContainsAny

func StringSliceContainsAny(s []string, keys ...string) bool

func StringSliceCut

func StringSliceCut(items []string, search string) (left, right []string, found bool)

func StringSliceExclude

func StringSliceExclude(s []string, exclude []string) (res []string)

func StringSliceMerge

func StringSliceMerge(a []string, b []string) (res []string)

func StringSliceRemove

func StringSliceRemove(haystack []string, needle string) (res []string)

func StringSplitMany

func StringSplitMany(val string, seperators ...string) (parts []string)

Types

type BuildConfig

type BuildConfig struct {
	OutputDir      string
	Name           string
	GoVersion      string
	NameTemplate   string
	BundleTemplate string
	BuildArgs      []string
	Clean          bool
	Dry            bool
	ShowTargets    bool
	Verbose        bool
	CGO            bool
	LdFlags        string
	Debug          bool
	Generate       bool

	Aliases         StringSlice
	DistributionSet DistributionSet
}

type Cmd

type Cmd struct {
	Name             string
	ShortDescription string
	LongDescription  string
	Parse            func(set *flag.FlagSet, args []string) error
	Init             func(*flag.FlagSet) error
	Exec             func(*flag.FlagSet) error
}

type Commands

type Commands []Cmd

type Distribution

type Distribution struct {
	GOOS         string
	GOARCH       string
	FirstClass   bool
	CgoSupported bool
	BuildPath    string
}

type DistributionSet

type DistributionSet []Distribution

func GetAllDistributions

func GetAllDistributions() (res DistributionSet, err error)

func GetBuildTargets

func GetBuildTargets(config BuildConfig) (res DistributionSet, err error)

func (DistributionSet) Copy

func (d DistributionSet) Copy() (res DistributionSet)

func (DistributionSet) Difference

func (d DistributionSet) Difference(other DistributionSet) (res DistributionSet)

func (DistributionSet) Has

func (d DistributionSet) Has(val Distribution) bool

func (DistributionSet) Only

func (d DistributionSet) Only(systems ...string) (res DistributionSet)

func (DistributionSet) OnlyArch

func (d DistributionSet) OnlyArch(archs ...string) (res DistributionSet)

func (*DistributionSet) Set

func (d *DistributionSet) Set(val string) error

func (DistributionSet) String

func (d DistributionSet) String() (res string)

func (DistributionSet) Union

func (d DistributionSet) Union(other DistributionSet) (res DistributionSet)

func (DistributionSet) WithoutArch

func (d DistributionSet) WithoutArch(archs ...string) (res DistributionSet)

type GoModule

type GoModule struct {
	Name      string
	GoVersion string
}

func ApplyModule

func ApplyModule(config *BuildConfig) (mod GoModule, err error)

func ParseMod

func ParseMod(loc string) (mod GoModule, err error)

Parse package name and go version from a go.mod file

type SMap

type SMap map[string][]string

func (SMap) Copy

func (m SMap) Copy() (res SMap)

func (SMap) OnlyKeys

func (m SMap) OnlyKeys(keys ...string) (res SMap)

func (SMap) Union

func (m SMap) Union(other SMap) (res SMap)

func (SMap) WithoutKeys

func (m SMap) WithoutKeys(keys ...string) (res SMap)

func (SMap) WithoutVals

func (m SMap) WithoutVals(vals ...string) (res SMap)

type StringSlice

type StringSlice []string

func (*StringSlice) Set

func (s *StringSlice) Set(val string) error

func (*StringSlice) String

func (s *StringSlice) String() string

Jump to

Keyboard shortcuts

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