gomodvendor

package module
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

README

Go Mod Vendor Cloud Native Buildpack

The Go Mod Vendor CNB executes the go mod vendor command in the app's working directory to create a vendored copy of dependencies.

Integration

The Go Mod Vendor CNB doesn't provide any dependencies directly. To execute the go mod vendor command, the buildpack requires the go dependency, which can be supplied by a buildpack like the Go Distribution CNB.

Usage

To package this buildpack for distribution:

$ ./scripts/package.sh

By default, this script packages the buildpack's Go source using GOOS=linux. You can specify another value as the first argument to package.sh.

buildpack.yml Configuration

The Go Mod Vendor buildpack doesn't support configurations via buildpack.yml.

Go Version

This buildpack will request the latest minor version of the major.minor version it finds in the go.mod file from the go-dist buildpack.

Documentation

Index

Constants

View Source
const (
	GoLayerName   = "go"
	GoModLocation = "go.mod"
)

Variables

This section is empty.

Functions

func Build

func Build(buildProcess BuildProcess, logs scribe.Emitter, clock chronos.Clock, sbomGenerator SBOMGenerator) packit.BuildFunc

func Detect

func Detect(goModParser VersionParser) packit.DetectFunc

Types

type BuildPlanMetadata

type BuildPlanMetadata struct {
	VersionSource string `toml:"version-source"`
	Version       string `toml:"version"`
	Build         bool   `toml:"build"`
}

type BuildProcess

type BuildProcess interface {
	ShouldRun(workingDir string) (ok bool, reason string, err error)
	Execute(path, workingDir string) error
}

type Executable

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

type GoModParser

type GoModParser struct{}

func NewGoModParser

func NewGoModParser() GoModParser

func (GoModParser) ParseVersion

func (p GoModParser) ParseVersion(path string) (string, error)

type ModVendor

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

func NewModVendor

func NewModVendor(executable Executable, logs scribe.Emitter, clock chronos.Clock) ModVendor

func (ModVendor) Execute

func (m ModVendor) Execute(path, workingDir string) error

func (ModVendor) ShouldRun

func (m ModVendor) ShouldRun(workingDir string) (bool, string, error)

type SBOMGenerator

type SBOMGenerator interface {
	Generate(dir string) (sbom.SBOM, error)
}

type VersionParser

type VersionParser interface {
	ParseVersion(path string) (version string, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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