mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-07 04:39:01 +00:00
* fix(deps): update module gopkg.in/yaml.v2 to v3 in go.mod * chore: Upgrade to go-yaml v3 * Fix comment --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
34 lines
792 B
Go
34 lines
792 B
Go
package raw_test
|
|
|
|
import (
|
|
"io"
|
|
"strings"
|
|
|
|
"github.com/pkg/errors"
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
// Bool is a helper routine that allocates a new bool value
|
|
// to store v and returns a pointer to it.
|
|
func Bool(v bool) *bool { return &v }
|
|
|
|
// Int is a helper routine that allocates a new int value
|
|
// to store v and returns a pointer to it.
|
|
func Int(v int) *int { return &v }
|
|
|
|
// String is a helper routine that allocates a new string value
|
|
// to store v and returns a pointer to it.
|
|
func String(v string) *string { return &v }
|
|
|
|
// Helper function to unmarshal from strings
|
|
func unmarshalString(in string, out interface{}) error {
|
|
decoder := yaml.NewDecoder(strings.NewReader(in))
|
|
decoder.KnownFields(true)
|
|
|
|
err := decoder.Decode(out)
|
|
if errors.Is(err, io.EOF) {
|
|
return nil
|
|
}
|
|
return err
|
|
}
|