Documentation ¶
Overview ¶
Package k6foundry contains logic for building k6 binary
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Error compiling binary ErrCompiling = errors.New("compiling") // Error executing go command ErrExecutingGoCommand = errors.New("executing go command") // Go toolchacin is not installed ErrNoGoToolchain = errors.New("go toolchain notfound") // Git is not installed ErrNoGit = errors.New("git notfound") // Error resolving dependency ErrResolvingDependency = errors.New("resolving dependency") // Error initiailizing go build environment ErrSettingGoEnv = errors.New("setting go environment") )
var (
ErrInvalidDependencyFormat = errors.New("invalid dependency format") //nolint:revive
)
var ErrInvalidPlatform = errors.New("invalid platform") //nolint:revive
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { // Build returns a custom k6 binary for the given version including a set of dependencies Build( ctx context.Context, platform Platform, k6Version string, mods []Module, buildOpts []string, out io.Writer, ) (*BuildInfo, error) }
Builder defines the interface for building a k6 binary
func NewDefaultNativeBuilder ¶
NewDefaultNativeBuilder creates a new native build environment with default options
func NewNativeBuilder ¶
func NewNativeBuilder(_ context.Context, opts NativeBuilderOpts) (Builder, error)
NewNativeBuilder creates a new native build environment with the given options
type GoOpts ¶
type GoOpts struct { // Environment variables passed to the build service // Can override variables copied from the current go environment Env map[string]string // Copy Environment variables to go build environment CopyGoEnv bool // Timeout for getting modules GoGetTimeout time.Duration // Timeout for building binary GOBuildTimeout time.Duration // Use an ephemeral cache. Ignores GoModCache and GoCache TmpCache bool }
GoOpts defines the options for the go build environment
type Module ¶
type Module struct { // The name (import path) of the go module. If at a version > 1, // it should contain semantic import version (i.e. "/v2"). // Used with `go get`. Path string // The version of the Go module, as used with `go get`. Version string // Module replacement ReplacePath string // Module replace version ReplaceVersion string }
Module reference a go module and its version
func ParseModule ¶
ParseModule parses a module from a string of the form path[@version][=replace[@version]]
type NativeBuilderOpts ¶
type NativeBuilderOpts struct { // options used for running go GoOpts // use alternative k6 repository K6Repo string // don't cleanup work environment (useful for debugging) SkipCleanup bool // redirect stdout Stdout io.Writer // redirect stderr Stderr io.Writer // set log level (INFO, WARN, ERROR) Logger *slog.Logger }
NativeBuilderOpts defines the options for the Native build environment
type Platform ¶
Platform defines a target OS and architecture for building a custom binary
func NewPlatform ¶
NewPlatform creates a new Platform given the os and arch
func ParsePlatform ¶
ParsePlatform parses a string of the format os/arch and returns the corresponding platform
func RuntimePlatform ¶
func RuntimePlatform() Platform
RuntimePlatform returns the Platform of the current executable
func SupportedPlatforms ¶
func SupportedPlatforms() []Platform
SupportedPlatforms returns a list of supported platforms
Directories ¶
Path | Synopsis |
---|---|
Package cmd implements the k6foundry command nolint:forbidigo,funlen,nolintlint
|
Package cmd implements the k6foundry command nolint:forbidigo,funlen,nolintlint |
k6foundry
package main implements the CLI root command for the k6foundry tool
|
package main implements the CLI root command for the k6foundry tool |
pkg
|
|
testutils/goproxy
Package goproxy implements a go proxy that resolves requests from an in memory go mood cache
|
Package goproxy implements a go proxy that resolves requests from an in memory go mood cache |
util
Package util implements helper functions
|
Package util implements helper functions |