Documentation ¶
Overview ¶
Package dependencies checks dependencies, locally or remotely
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client holds any client that is needed
func NewClient ¶
func NewClient() *Client
NewClient returns all clients that can be used to the validation
func (*Client) LocalCheck ¶
LocalCheck checks whether dependencies are in-sync locally
Will return an error if the dependency cannot be found in the files it has defined, or if the version does not match
func (*Client) RemoteCheck ¶
RemoteCheck checks whether dependencies are up to date with upstream
Will return an error if checking the versions upstream fails.
Out-of-date dependencies will be printed out on stdout at the INFO level.
func (*Client) RemoteExport ¶
func (c *Client) RemoteExport(dependencyFilePath string) ([]VersionUpdate, error)
type Dependencies ¶
type Dependencies struct {
Dependencies []*Dependency `yaml:"dependencies"`
}
Dependencies is used to deserialise the configuration file
type Dependency ¶
type Dependency struct { Name string `yaml:"name"` // Version of the dependency that should be present throughout your code Version string `yaml:"version"` // Scheme for versioning this dependency Scheme VersionScheme `yaml:"scheme"` // Optional: sensitivity, to alert e.g. on new major versions Sensitivity VersionSensitivity `yaml:"sensitivity,omitempty"` // Optional: upstream Upstream map[string]string `yaml:"upstream,omitempty"` // List of references to this dependency in local files RefPaths []*RefPath `yaml:"refPaths"` }
Dependency is the internal representation of a dependency
func (*Dependency) UnmarshalYAML ¶
func (decoded *Dependency) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements custom unmarshalling of Dependency with validation
type RefPath ¶
type RefPath struct { // Path of the file to test Path string `yaml:"path"` // Match expression for the line that should contain the dependency's version. Regexp is supported. Match string `yaml:"match"` }
RefPath represents a file to check for a reference to the version
type Version ¶
type Version struct { Version string Scheme VersionScheme }
Version is the internal representation of a Version as a string and a scheme
func (Version) MoreRecentThan ¶
MoreRecentThan checks whether a given version is more recent than another one.
If the VersionScheme is "random", then it will return true if a != b.
func (Version) MoreSensitivelyRecentThan ¶
func (a Version) MoreSensitivelyRecentThan(b Version, sensitivity VersionSensitivity) (bool, error)
MoreSensitivelyRecentThan checks whether a given version is more recent than another one, accepting a VersionSensitivity argument
If the VersionScheme is "random", then it will return true if a != b.
type VersionScheme ¶
type VersionScheme string
VersionScheme informs us on how to compare two versions
const ( // Semver [Semantic versioning](https://semver.org/), default Semver VersionScheme = "semver" // Alpha Alphanumeric, will use standard string sorting Alpha VersionScheme = "alpha" // Random when releases do not support sorting (e.g. hashes) Random VersionScheme = "random" )
type VersionSensitivity ¶
type VersionSensitivity string
VersionSensitivity informs us on how to compare whether a version is more recent than another, for example to only notify on new major versions Only applicable to Semver versioning
const ( // Patch version, e.g. 1.1.1 -> 1.1.2, default Patch VersionSensitivity = "patch" // Minor version, e.g. 1.1.1 -> 1.2.0 Minor VersionSensitivity = "minor" // Major version, e.g. 1.1.1 -> 2.0.0 Major VersionSensitivity = "major" )
type VersionUpdate ¶
type VersionUpdate struct { Name string `yaml:"name" json:"name"` Version string `yaml:"version" json:"version"` NewVersion string `yaml:"new_version" json:"new_version"` }
VersionUpdate represents the schema of the output format The output format is dictated by exportOptions.outputFormat