Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

type Loader struct{}

Loader handles loading and saving melange configurations while preserving YAML structure

func NewLoader

func NewLoader() *Loader

NewLoader creates a new config loader

func (*Loader) FindPipelinesByUse

func (l *Loader) FindPipelinesByUse(yamlContent []byte, useType string) ([]int, error)

FindPipelinesByUse finds pipeline indices that use a specific pipeline type

func (*Loader) GetGoBumpDeps

func (l *Loader) GetGoBumpDeps(yamlContent []byte, pipelineIndex int) ([]string, error)

GetGoBumpDeps extracts the deps field from a go/bump pipeline

func (*Loader) GetPackageInfo

func (l *Loader) GetPackageInfo(yamlContent []byte) (name, version string, epoch int64, err error)

GetPackageInfo extracts package name and version from YAML content

func (*Loader) GetPipelineWithField

func (l *Loader) GetPipelineWithField(yamlContent []byte, pipelineIndex int) (map[string]string, error)

GetPipelineWithField gets the with field map for a specific pipeline

func (*Loader) IncrementEpoch

func (l *Loader) IncrementEpoch(yamlContent []byte) ([]byte, error)

IncrementEpoch increments the epoch field by 1

func (*Loader) InsertGoBumpPipelineStep

func (l *Loader) InsertGoBumpPipelineStep(yamlContent []byte, pipelineIndex int, deps []string) ([]byte, error)

InsertGoBumpPipelineStep inserts a go/bump step with block scalar deps

func (*Loader) InsertPipelineStep

func (l *Loader) InsertPipelineStep(yamlContent []byte, pipelineIndex int, pipelineStep map[string]any) ([]byte, error)

InsertPipelineStep inserts a new pipeline step at the specified index

func (*Loader) LoadWithPreservation

func (l *Loader) LoadWithPreservation(path string) (*config.Configuration, []byte, error)

LoadWithPreservation loads a melange config while preserving YAML structure and comments

func (*Loader) RemovePipelineStep

func (l *Loader) RemovePipelineStep(yamlContent []byte, pipelineIndex int) ([]byte, error)

RemovePipelineStep removes a single pipeline step by index while preserving formatting

func (*Loader) Save

func (l *Loader) Save(path string, content []byte, backupSuffix string) error

Save saves the updated YAML content to file, optionally creating a backup backupSuffix: suffix for backup files (empty = no backup) Returns error if save failed, nil if no changes needed or save successful

func (*Loader) SaveWithBackup

func (l *Loader) SaveWithBackup(path string, content []byte) error

SaveWithBackup saves the updated YAML content to file with backup

func (*Loader) SetEpoch

func (l *Loader) SetEpoch(yamlContent []byte, newEpoch int64) ([]byte, error)

SetEpoch sets the epoch field to a specific value

func (*Loader) UpdateField

func (l *Loader) UpdateField(yamlContent []byte, path, newValue string) ([]byte, error)

UpdateField updates a specific field in the YAML while preserving structure

func (*Loader) UpdateFieldAsQuotedString

func (l *Loader) UpdateFieldAsQuotedString(yamlContent []byte, path string, newValue string) ([]byte, error)

UpdateFieldAsQuotedString updates a field with a double-quoted string value This is essential for fields like package.version where values like "1.0" must be rendered as strings to prevent YAML from interpreting them as numbers

func (*Loader) UpdateFieldWithBlockScalar

func (l *Loader) UpdateFieldWithBlockScalar(yamlContent []byte, path string, newValue string) ([]byte, error)

UpdateFieldWithBlockScalar updates a field to use block scalar format (|-)

func (*Loader) UpdateGoBumpDeps

func (l *Loader) UpdateGoBumpDeps(yamlContent []byte, pipelineIndex int, newDeps []string) ([]byte, error)

UpdateGoBumpDeps updates the deps field in a go/bump pipeline

func (*Loader) UpdateIntField

func (l *Loader) UpdateIntField(yamlContent []byte, path string, newValue int64) ([]byte, error)

UpdateIntField updates an integer field in the YAML

func (*Loader) UpdatePackageVersion

func (l *Loader) UpdatePackageVersion(yamlContent []byte, newVersion string) ([]byte, error)

UpdatePackageVersion updates the package version (epoch handling moved to EpochApplier)

func (*Loader) UpdatePipelineField

func (l *Loader) UpdatePipelineField(yamlContent []byte, pipelineIndex int, field, newValue string) ([]byte, error)

UpdatePipelineField updates a field within a specific pipeline

func (*Loader) ValidateUpdatedConfig

func (l *Loader) ValidateUpdatedConfig(content []byte, tempPath string) error

ValidateUpdatedConfig validates that the updated YAML is still valid

type Renderer

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

Renderer provides variable rendering for melange configurations It builds a complete variable context and can render strings or entire configs

func NewRenderer

func NewRenderer(cfg *melange.Configuration) (*Renderer, error)

NewRenderer creates a new renderer for the given melange configuration

func (*Renderer) GetVariable

func (r *Renderer) GetVariable(key string) (string, bool)

GetVariable gets the value of a specific variable

func (*Renderer) GetVariableMap

func (r *Renderer) GetVariableMap() map[string]string

GetVariableMap returns a copy of the complete variable map

func (*Renderer) RenderConfig

func (r *Renderer) RenderConfig() (*melange.Configuration, error)

RenderConfig creates a new configuration with all variables resolved This is useful when you need a fully rendered config for processing

func (*Renderer) RenderString

func (r *Renderer) RenderString(template string) (string, error)

RenderString renders a template string with full variable substitution

Jump to

Keyboard shortcuts

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