Documentation ¶
Overview ¶
Package golang provides building blocks for Go-based projects.
Index ¶
- Constants
- type Build
- func (build *Build) CompileDockerfile(output *dockerfile.Output) error
- func (build *Build) CompileDrone(output *drone.Output) error
- func (build *Build) CompileGitHubWorkflow(output *ghworkflow.Output) error
- func (build *Build) CompileMakefile(output *makefile.Output) error
- func (build *Build) Entrypoint() string
- type CompileConfig
- type DeepCopy
- type File
- type Generate
- func (generate *Generate) CompileDockerfile(output *dockerfile.Output) error
- func (generate *Generate) CompileDockerignore(output *dockerignore.Output) error
- func (generate *Generate) CompileMakefile(output *makefile.Output) error
- func (generate *Generate) CompileTemplates(output *template.Output) error
- func (generate *Generate) ToolchainBuild(stage *dockerfile.Stage) error
- type GoGenerateSpec
- type GoVulnCheck
- type Gofumpt
- type GolangciLint
- type Linters
- type ProtoSpec
- type Toolchain
- func (toolchain *Toolchain) AfterLoad() error
- func (toolchain *Toolchain) CompileDockerfile(output *dockerfile.Output) error
- func (toolchain *Toolchain) CompileDrone(output *drone.Output) error
- func (toolchain *Toolchain) CompileGitHubWorkflow(output *ghworkflow.Output) error
- func (toolchain *Toolchain) CompileMakefile(output *makefile.Output) error
- func (toolchain *Toolchain) SkipAsMakefileDependency()
- type ToolchainKind
- type UnitTests
Constants ¶
const ( ToolchainOfficial = iota ToolchainTools )
Toolchain kinds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct { dag.BaseNode Outputs map[string]CompileConfig `yaml:"outputs"` BuildFlags []string `yaml:"buildFlags"` // contains filtered or unexported fields }
Build produces binaries for Go programs.
func (*Build) CompileDockerfile ¶
func (build *Build) CompileDockerfile(output *dockerfile.Output) error
CompileDockerfile implements dockerfile.Compiler.
func (*Build) CompileDrone ¶
CompileDrone implements drone.Compiler.
func (*Build) CompileGitHubWorkflow ¶
func (build *Build) CompileGitHubWorkflow(output *ghworkflow.Output) error
CompileGitHubWorkflow implements ghworkflow.Compiler.
func (*Build) CompileMakefile ¶
CompileMakefile implements makefile.Compiler.
func (*Build) Entrypoint ¶
Entrypoint implements dockerfile.CmdCompiler.
type CompileConfig ¶
CompileConfig defines Go cross compile architecture settings.
type DeepCopy ¶
type DeepCopy struct { dag.BaseNode Version string `yaml:"version"` // contains filtered or unexported fields }
DeepCopy provides goimports deepcopyer.
func (*DeepCopy) CompileMakefile ¶
CompileMakefile implements makefile.Compiler.
func (*DeepCopy) ToolchainBuild ¶
func (deepcopy *DeepCopy) ToolchainBuild(stage *dockerfile.Stage) error
ToolchainBuild implements common.ToolchainBuilder hook.
type Generate ¶
type Generate struct { dag.BaseNode ProtobufGoVersion string `yaml:"protobufGoVersion"` GrpcGoVersion string `yaml:"grpcGoVersion"` GrpcGatewayVersion string `yaml:"grpcGatewayVersion"` VTProtobufVersion string `yaml:"vtProtobufVersion"` GoImportsVersion string `yaml:"goImportsVersion"` BaseSpecPath string `yaml:"baseSpecPath"` Specs []ProtoSpec `yaml:"specs"` GoGenerateSpecs []GoGenerateSpec `yaml:"goGenerateSpecs"` ExperimentalFlags []string `yaml:"experimentalFlags"` Files []File `yaml:"files"` VTProtobufEnabled bool `yaml:"vtProtobufEnabled"` VersionPackagePath string `yaml:"versionPackagePath"` LicenseText string `yaml:"licenseText"` // contains filtered or unexported fields }
Generate provides .proto compilation with grpc-go plugin and go generate runner.
func (*Generate) CompileDockerfile ¶
func (generate *Generate) CompileDockerfile(output *dockerfile.Output) error
CompileDockerfile implements dockerfile.Compiler.
func (*Generate) CompileDockerignore ¶
func (generate *Generate) CompileDockerignore(output *dockerignore.Output) error
CompileDockerignore implements dockerignore.Compiler.
func (*Generate) CompileMakefile ¶
CompileMakefile implements makefile.Compiler.
func (*Generate) CompileTemplates ¶
CompileTemplates implements template.Compiler.
func (*Generate) ToolchainBuild ¶
func (generate *Generate) ToolchainBuild(stage *dockerfile.Stage) error
ToolchainBuild implements common.ToolchainBuilder hook.
type GoGenerateSpec ¶
GoGenerateSpec describes a set of go generate specs to be compiled.
type GoVulnCheck ¶
type GoVulnCheck struct { dag.BaseNode Disabled bool `yaml:"disabled"` // contains filtered or unexported fields }
GoVulnCheck provides GoVulnCheck linter.
func NewGoVulnCheck ¶
func NewGoVulnCheck(meta *meta.Options, projectPath string) *GoVulnCheck
NewGoVulnCheck builds GoVulnCheck node.
func (*GoVulnCheck) CompileDockerfile ¶
func (lint *GoVulnCheck) CompileDockerfile(output *dockerfile.Output) error
CompileDockerfile implements dockerfile.Compiler.
func (*GoVulnCheck) CompileMakefile ¶
func (lint *GoVulnCheck) CompileMakefile(output *makefile.Output) error
CompileMakefile implements makefile.Compiler.
type Gofumpt ¶
type Gofumpt struct { dag.BaseNode GoVersion string `yaml:"goVersion"` Version string `yaml:"version"` // contains filtered or unexported fields }
Gofumpt provides gofumpt linter.
func NewGofumpt ¶
NewGofumpt builds Gofumpt node.
func (*Gofumpt) CompileDockerfile ¶
func (lint *Gofumpt) CompileDockerfile(output *dockerfile.Output) error
CompileDockerfile implements dockerfile.Compiler.
type GolangciLint ¶
GolangciLint provides golangci-lint.
func NewGolangciLint ¶
func NewGolangciLint(meta *meta.Options, projectPath string) *GolangciLint
NewGolangciLint builds golangci-lint node.
func (*GolangciLint) CompileDockerfile ¶
func (lint *GolangciLint) CompileDockerfile(output *dockerfile.Output) error
CompileDockerfile implements dockerfile.Compiler.
func (*GolangciLint) CompileGolangci ¶
func (lint *GolangciLint) CompileGolangci(output *golangci.Output) error
CompileGolangci implements golangci.Compiler.
func (*GolangciLint) CompileMakefile ¶
func (lint *GolangciLint) CompileMakefile(output *makefile.Output) error
CompileMakefile implements makefile.Compiler.
type Linters ¶
Linters is the common node for all linters.
func (*Linters) SkipAsMakefileDependency ¶
func (linters *Linters) SkipAsMakefileDependency()
SkipAsMakefileDependency implements makefile.SkipAsMakefileDependency.
func (*Linters) ToolchainBuild ¶
func (linters *Linters) ToolchainBuild(stage *dockerfile.Stage) error
ToolchainBuild implements common.ToolchainBuilder hook.
type ProtoSpec ¶
type ProtoSpec struct { Source string `yaml:"source"` External *bool `yaml:"external"` SubDirectory string `yaml:"subdirectory"` SkipCompile bool `yaml:"skipCompile"` GenGateway bool `yaml:"genGateway"` // contains filtered or unexported fields }
ProtoSpec describes a set of protobuf specs to be compiled.
type Toolchain ¶
type Toolchain struct { dag.BaseNode Kind ToolchainKind Version string Image string ExtraPackages []string `yaml:"extraPackages"` PrivateRepos []string `yaml:"privateRepos"` Makefile struct { ExtraVariables []struct { Name string `yaml:"name"` DefaultValue string `yaml:"defaultValue"` } `yaml:"extraVariables"` } `yaml:"makefile"` Docker struct { ExtraArgs []string `yaml:"extraArgs"` } `yaml:"docker"` // contains filtered or unexported fields }
Toolchain provides Go compiler and common utilities.
func NewToolchain ¶
NewToolchain builds Toolchain with default values.
func (*Toolchain) AfterLoad ¶
AfterLoad adds the github token to the build args in this case, making it possible to configure git and go to use private repositories.
func (*Toolchain) CompileDockerfile ¶
func (toolchain *Toolchain) CompileDockerfile(output *dockerfile.Output) error
CompileDockerfile implements dockerfile.Compiler.
func (*Toolchain) CompileDrone ¶
CompileDrone implements drone.Compiler.
func (*Toolchain) CompileGitHubWorkflow ¶
func (toolchain *Toolchain) CompileGitHubWorkflow(output *ghworkflow.Output) error
CompileGitHubWorkflow implements ghworkflow.Compiler.
func (*Toolchain) CompileMakefile ¶
CompileMakefile implements makefile.Compiler.
func (*Toolchain) SkipAsMakefileDependency ¶
func (toolchain *Toolchain) SkipAsMakefileDependency()
SkipAsMakefileDependency implements makefile.SkipAsMakefileDependency.
type UnitTests ¶
type UnitTests struct { dag.BaseNode RequiresInsecure bool `yaml:"requiresInsecure"` // ExtraArgs are extra arguments for `go test`. ExtraArgs string `yaml:"extraArgs"` Docker struct { Steps []struct { Copy *struct { From string `yaml:"from"` Platform string `yaml:"platform"` Src string `yaml:"src"` Dst string `yaml:"dst"` } `yaml:"copy"` Arg string `yaml:"arg"` } `yaml:"steps"` } `yaml:"docker"` // contains filtered or unexported fields }
UnitTests runs unit-tests for Go packages.
func NewUnitTests ¶
NewUnitTests initializes UnitTests.
func (*UnitTests) CompileDockerfile ¶
func (tests *UnitTests) CompileDockerfile(output *dockerfile.Output) error
CompileDockerfile implements dockerfile.Compiler.
func (*UnitTests) CompileDrone ¶
CompileDrone implements drone.Compiler.
func (*UnitTests) CompileGitHubWorkflow ¶
func (tests *UnitTests) CompileGitHubWorkflow(output *ghworkflow.Output) error
CompileGitHubWorkflow implements ghworkflow.Compiler.