golang

package
v0.109.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	GoModFile string = "go.mod"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Golang

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

Golang holds all information needed to generate golang manifest.

func New

func New(spec interface{}, rootDir, scmID, actionID string) (Golang, error)

New return a new valid object.

func (Golang) DiscoverManifests

func (n Golang) DiscoverManifests() ([][]byte, error)

type MatchingRule

type MatchingRule struct {
	// Path specifies a go.mod path pattern
	// The pattern syntax is:
	// pattern:
	//     { term }
	// term:
	//     '*'         matches any sequence of non-Separator characters
	//     '?'         matches any single non-Separator character
	//     '[' [ '^' ] { character-range } ']'
	//                 character class (must be non-empty)
	//     c           matches character c (c != '*', '?', '\\', '[')
	//     '\\' c      matches character c
	// example:
	//   * 'go.mod' matches 'go.mod' in the current directory
	//   * '*/go.mod' matches 'go.mod' in any first level subdirectory
	Path string
	// Modules specifies a list of module pattern.
	// The module accepts regular expression for module name and semantic versioning constraint for module version.
	// If module version is empty then any version is matching.
	// Example:
	//   * 'github.com/updatecli/updatecli': ” matches any version of the module github.com/updatecli/updatecli
	//   * 'github.com/updatecli/updatecli': '1.0.0' matches only version 1.0.0 of the module github.com/updatecli/updatecli
	//   * 'github.com/updatecli/updatecli': '>=1.0.0' matches any version greater than or equal to 1.0.0 of the module github.com/updatecli/updatecli
	//   * 'github.com/.*': '>=1.0.0' matches any version greater than or equal to 1.0.0 of any module hosted under github.com
	//   * 'github\.com\/updatecli\/updatecli': '>=1.0.0' matches any version greater than or equal to 1.
	Modules map[string]string
	// GoVersions specifies a list of version pattern.
	// The version constraint must be a valid semantic version constraint.
	// If GoVersion is empty then any version is matching.
	// Example:
	//   * '1.19.*' matches any 1.19.x version
	//  * '>=1.20.0' matches any version greater than or equal to 1.20.0
	//   * '<1.20.0' matches any version strictly less than 1.20.0
	//   * '*' matches any version
	GoVersion string
	// Replace indicates if the module is a replace directive.
	// If Replace is nil then any module is matching.
	// If Replace is true then only module with a replace directive is matching.
	// If Replace is false then only module without a replace directive is matching.
	Replace *bool
}

MatchingRule allows to specifies rules to identify manifest to update based on file path, module name, module version, go version and replace directive.

type MatchingRules

type MatchingRules []MatchingRule

type Replace added in v0.107.0

type Replace struct {
	OldPath    string
	OldVersion string
	NewPath    string
	NewVersion string
}

type Spec

type Spec struct {
	// rootDir defines the root directory used to recursively search for golang go.mod
	RootDir string `yaml:",omitempty"`
	// OnlyGoVersion allows to specify if the autodiscovery should only handle Go version specified in go.mod
	OnlyGoVersion *bool `yaml:",omitempty"`
	// OnlyGoModule allows to specify if the autodiscovery should only handle Go module specified in go.mod
	OnlyGoModule *bool `yaml:",omitempty"`
	// ignore allows to specify "rule" to ignore autodiscovery a specific go.mod rule
	Ignore MatchingRules `yaml:",omitempty"`
	/*
		`only` allows to specify rule to "only" autodiscover manifest for a specific golang rule
	*/
	Only MatchingRules `yaml:",omitempty"`
	/*
		`versionfilter` provides parameters to specify the version pattern to use when generating manifest.

		kind - semver
			versionfilter of kind `semver` uses semantic versioning as version filtering
			pattern accepts one of:
				`patch` - patch only update patch version
				`minor` - minor only update minor version
				`major` - major only update major versions
				`a version constraint` such as `>= 1.0.0`

		kind - regex
			versionfilter of kind `regex` uses regular expression as version filtering
			pattern accepts a valid regular expression

		example:
		“`
			versionfilter:
				kind: semver
				pattern: minor
		“`

		and its type like regex, semver, or just latest.
	*/
	VersionFilter version.Filter `yaml:",omitempty"`
}

Spec defines the parameters which can be provided to the Golang autodiscovery builder.

Jump to

Keyboard shortcuts

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