gobuild

package module
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

README

Go Build Cloud Native Buildpack

The Go Build CNB executes the go build compilation process for Go programs. The buildpack builds the source code in the application directory into an executable and sets it as the start command for the image.

Integration

The Go Build CNB does not provide any dependencies. However, in order to execute the go build compilation process, the buildpack requires the go dependency that can be provided by a buildpack like the Go Distribution CNB.

Usage

To package this buildpack for consumption:

$ ./scripts/package.sh

This builds the buildpack's Go source using GOOS=linux by default. You can supply another value as the first argument to package.sh.

buildpack.yml Configurations

go:
  # The go.targets property allows you to specify multiple programs to be
  # compiled. The first target will be used as the start command for the image.
  targets:
  - ./cmd/web-server
  - ./cmd/debug-server

Documentation

Index

Constants

View Source
const (
	TargetsLayerName = "targets"
	GoCacheLayerName = "gocache"
	WorkspaceSHAKey  = "workspace_sha"
	TinyStackName    = "io.paketo.stacks.tiny"
)

Variables

This section is empty.

Functions

func Build

func Build(
	buildProcess BuildProcess,
	pathManager PathManager,
	clock chronos.Clock,
	checksumCalculator ChecksumCalculator,
	logs LogEmitter,
	parser ConfigurationParser,
	sourceRemover SourceRemover,
) packit.BuildFunc

func Detect

func Detect(parser ConfigurationParser) packit.DetectFunc

Types

type BuildConfigurationParser added in v0.0.5

type BuildConfigurationParser struct{}

func NewBuildConfigurationParser added in v0.0.5

func NewBuildConfigurationParser() BuildConfigurationParser

func (BuildConfigurationParser) Parse added in v0.0.5

func (p BuildConfigurationParser) Parse(path string) ([]string, []string, error)

type BuildProcess

type BuildProcess interface {
	Execute(config GoBuildConfiguration) (command string, err error)
}

type ChecksumCalculator

type ChecksumCalculator interface {
	Sum(path string) (sha string, err error)
}

type ConfigurationParser added in v0.0.5

type ConfigurationParser interface {
	Parse(path string) (targets, flags []string, err error)
}

type Executable

type Executable interface {
	Execute(pexec.Execution) (err error)
}

type GoBuildConfiguration added in v0.0.5

type GoBuildConfiguration struct {
	Workspace string
	Output    string
	GoPath    string
	GoCache   string
	Targets   []string
	Flags     []string
}

type GoBuildProcess

type GoBuildProcess struct {
	// contains filtered or unexported fields
}

func NewGoBuildProcess

func NewGoBuildProcess(executable Executable, logs LogEmitter, clock chronos.Clock) GoBuildProcess

func (GoBuildProcess) Execute

func (p GoBuildProcess) Execute(config GoBuildConfiguration) (string, error)

type GoPathManager

type GoPathManager struct {
	// contains filtered or unexported fields
}

func NewGoPathManager

func NewGoPathManager(tempDir string) GoPathManager

func (GoPathManager) Setup

func (m GoPathManager) Setup(workspace string) (string, string, error)

func (GoPathManager) Teardown

func (m GoPathManager) Teardown(path string) error

type LogEmitter

type LogEmitter struct {
	scribe.Logger
}

func NewLogEmitter

func NewLogEmitter(output io.Writer) LogEmitter

type PathManager

type PathManager interface {
	Setup(workspace string) (goPath, path string, err error)
	Teardown(goPath string) error
}

type SourceDeleter

type SourceDeleter struct{}

func NewSourceDeleter

func NewSourceDeleter() SourceDeleter

func (SourceDeleter) Clear

func (d SourceDeleter) Clear(path string) error

type SourceRemover

type SourceRemover interface {
	Clear(path string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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