mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-30 08:08:42 +00:00
25 lines
674 B
Go
25 lines
674 B
Go
// Package raw contains the golang representations of the YAML elements
|
|
// supported in atlantis.yaml. The structs here represent the exact data that
|
|
// comes from the file before it is parsed/validated further.
|
|
package raw
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
version "github.com/hashicorp/go-version"
|
|
)
|
|
|
|
// VersionValidator helper function to validate binary version.
|
|
// Function implements ozzo-validation::Rule.Validate interface.
|
|
func VersionValidator(value interface{}) error {
|
|
strPtr := value.(*string)
|
|
if strPtr == nil {
|
|
return nil
|
|
}
|
|
_, err := version.NewVersion(*strPtr)
|
|
if err != nil {
|
|
return fmt.Errorf("version %q could not be parsed: %w", *strPtr, err)
|
|
}
|
|
return nil
|
|
}
|