builder

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrGoNotFound is returned when a Go binary hasn't been found
	ErrGoNotFound      = errors.New("go binary not found")
	ErrDepNotFound     = errors.New("dependency not found in go mod file")
	ErrVersionMismatch = errors.New("mismatch in go.mod and builder configuration versions")
)

Functions

func Compile

func Compile(cfg *Config) error

Compile generates a binary from the sources based on the configuration

func Generate

func Generate(cfg *Config) error

Generate assembles a new distribution based on the given configuration

func GenerateAndCompile

func GenerateAndCompile(cfg *Config) error

GenerateAndCompile will generate the source files based on the given configuration, update go mod, and will compile into a binary

func GetModules

func GetModules(cfg *Config) error

GetModules retrieves the go modules, updating go.mod and go.sum in the process

Types

type ConfResolver added in v0.103.0

type ConfResolver struct {
	// When set, will be used to set the CollectorSettings.ConfResolver.DefaultScheme value,
	// which determines how the Collector interprets URIs that have no scheme, such as ${ENV}.
	// See https://pkg.go.dev/go.opentelemetry.io/collector/confmap#ResolverSettings for more details.
	DefaultURIScheme string `mapstructure:"default_uri_scheme"`
}

type Config

type Config struct {
	Logger *zap.Logger

	OtelColVersion       string `mapstructure:"-"` // only used be the go.mod template
	SkipGenerate         bool   `mapstructure:"-"`
	SkipCompilation      bool   `mapstructure:"-"`
	SkipGetModules       bool   `mapstructure:"-"`
	SkipStrictVersioning bool   `mapstructure:"-"`
	LDFlags              string `mapstructure:"-"`
	Verbose              bool   `mapstructure:"-"`

	Distribution      Distribution `mapstructure:"dist"`
	Exporters         []Module     `mapstructure:"exporters"`
	Extensions        []Module     `mapstructure:"extensions"`
	Receivers         []Module     `mapstructure:"receivers"`
	Processors        []Module     `mapstructure:"processors"`
	Connectors        []Module     `mapstructure:"connectors"`
	ConfmapProviders  []Module     `mapstructure:"providers"`
	ConfmapConverters []Module     `mapstructure:"converters"`
	Replaces          []string     `mapstructure:"replaces"`
	Excludes          []string     `mapstructure:"excludes"`

	ConfResolver ConfResolver `mapstructure:"conf_resolver"`
	// contains filtered or unexported fields
}

Config holds the builder's configuration

func NewDefaultConfig added in v0.46.0

func NewDefaultConfig() (*Config, error)

NewDefaultConfig creates a new config, with default values

func (*Config) ParseModules

func (c *Config) ParseModules() error

ParseModules will parse the Modules entries and populate the missing values

func (*Config) SetGoPath added in v0.63.0

func (c *Config) SetGoPath() error

SetGoPath sets go path

func (*Config) Validate

func (c *Config) Validate() error

Validate checks whether the current configuration is valid

type Distribution

type Distribution struct {
	Module      string `mapstructure:"module"`
	Name        string `mapstructure:"name"`
	Go          string `mapstructure:"go"`
	Description string `mapstructure:"description"`
	// Deprecated: [v0.113.0] only here to return a detailed error and not failing during unmarshalling.
	OtelColVersion   string `mapstructure:"otelcol_version"`
	OutputPath       string `mapstructure:"output_path"`
	Version          string `mapstructure:"version"`
	BuildTags        string `mapstructure:"build_tags"`
	DebugCompilation bool   `mapstructure:"debug_compilation"`
}

Distribution holds the parameters for the final binary

type Module

type Module struct {
	Name   string `mapstructure:"name"`   // if not specified, this is package part of the go mod (last part of the path)
	Import string `mapstructure:"import"` // if not specified, this is the path part of the go mods
	GoMod  string `mapstructure:"gomod"`  // a gomod-compatible spec for the module
	Path   string `mapstructure:"path"`   // an optional path to the local version of this module
}

Module represents a receiver, exporter, processor or extension for the distribution

Jump to

Keyboard shortcuts

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