golang

package
v0.0.0-...-f249b6c Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package golang provides building blocks for Go-based projects.

Index

Constants

View Source
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 NewBuild

func NewBuild(meta *meta.Options, name, sourcePath string) *Build

NewBuild initializes Build.

func (*Build) CompileDockerfile

func (build *Build) CompileDockerfile(output *dockerfile.Output) error

CompileDockerfile implements dockerfile.Compiler.

func (*Build) CompileDrone

func (build *Build) CompileDrone(output *drone.Output) error

CompileDrone implements drone.Compiler.

func (*Build) CompileGitHubWorkflow

func (build *Build) CompileGitHubWorkflow(output *ghworkflow.Output) error

CompileGitHubWorkflow implements ghworkflow.Compiler.

func (*Build) CompileMakefile

func (build *Build) CompileMakefile(output *makefile.Output) error

CompileMakefile implements makefile.Compiler.

func (*Build) Entrypoint

func (build *Build) Entrypoint() string

Entrypoint implements dockerfile.CmdCompiler.

type CompileConfig

type CompileConfig map[string]string

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 NewDeepCopy

func NewDeepCopy(meta *meta.Options) *DeepCopy

NewDeepCopy builds DeepCopy node.

func (*DeepCopy) CompileMakefile

func (deepcopy *DeepCopy) CompileMakefile(output *makefile.Output) error

CompileMakefile implements makefile.Compiler.

func (*DeepCopy) ToolchainBuild

func (deepcopy *DeepCopy) ToolchainBuild(stage *dockerfile.Stage) error

ToolchainBuild implements common.ToolchainBuilder hook.

type File

type File struct {
	Source      string `yaml:"source"`
	Destination string `yaml:"destination"`
}

File represents a file to be fetched/copied into the image.

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 NewGenerate

func NewGenerate(meta *meta.Options) *Generate

NewGenerate builds Generate node.

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

func (generate *Generate) CompileMakefile(output *makefile.Output) error

CompileMakefile implements makefile.Compiler.

func (*Generate) CompileTemplates

func (generate *Generate) CompileTemplates(output *template.Output) error

CompileTemplates implements template.Compiler.

func (*Generate) ToolchainBuild

func (generate *Generate) ToolchainBuild(stage *dockerfile.Stage) error

ToolchainBuild implements common.ToolchainBuilder hook.

type GoGenerateSpec

type GoGenerateSpec struct {
	Source string   `yaml:"source"`
	Copy   []string `yaml:"copy"`
}

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

func NewGofumpt(meta *meta.Options, projectPath string) *Gofumpt

NewGofumpt builds Gofumpt node.

func (*Gofumpt) CompileDockerfile

func (lint *Gofumpt) CompileDockerfile(output *dockerfile.Output) error

CompileDockerfile implements dockerfile.Compiler.

func (*Gofumpt) CompileMakefile

func (lint *Gofumpt) CompileMakefile(output *makefile.Output) error

CompileMakefile implements makefile.Compiler.

type GolangciLint

type GolangciLint struct {
	dag.BaseNode

	Version string
	// contains filtered or unexported fields
}

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

type Linters struct {
	dag.BaseNode
	// contains filtered or unexported fields
}

Linters is the common node for all linters.

func NewLinters

func NewLinters(meta *meta.Options) *Linters

NewLinters builds GoVulnCheck node.

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

func NewToolchain(meta *meta.Options) *Toolchain

NewToolchain builds Toolchain with default values.

func (*Toolchain) AfterLoad

func (toolchain *Toolchain) AfterLoad() error

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

func (toolchain *Toolchain) CompileDrone(output *drone.Output) error

CompileDrone implements drone.Compiler.

func (*Toolchain) CompileGitHubWorkflow

func (toolchain *Toolchain) CompileGitHubWorkflow(output *ghworkflow.Output) error

CompileGitHubWorkflow implements ghworkflow.Compiler.

func (*Toolchain) CompileMakefile

func (toolchain *Toolchain) CompileMakefile(output *makefile.Output) error

CompileMakefile implements makefile.Compiler.

func (*Toolchain) SkipAsMakefileDependency

func (toolchain *Toolchain) SkipAsMakefileDependency()

SkipAsMakefileDependency implements makefile.SkipAsMakefileDependency.

type ToolchainKind

type ToolchainKind int

ToolchainKind is a Go compiler source.

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

func NewUnitTests(meta *meta.Options, packagePath string) *UnitTests

NewUnitTests initializes UnitTests.

func (*UnitTests) CompileDockerfile

func (tests *UnitTests) CompileDockerfile(output *dockerfile.Output) error

CompileDockerfile implements dockerfile.Compiler.

func (*UnitTests) CompileDrone

func (tests *UnitTests) CompileDrone(output *drone.Output) error

CompileDrone implements drone.Compiler.

func (*UnitTests) CompileGitHubWorkflow

func (tests *UnitTests) CompileGitHubWorkflow(output *ghworkflow.Output) error

CompileGitHubWorkflow implements ghworkflow.Compiler.

func (*UnitTests) CompileMakefile

func (tests *UnitTests) CompileMakefile(output *makefile.Output) error

CompileMakefile implements makefile.Compiler.

Directories

Path Synopsis
Package templates defines default templates for various Go components.
Package templates defines default templates for various Go components.

Jump to

Keyboard shortcuts

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