Files
atlantis/server/core/config/raw/raw_test.go
Luke Massa 34ef59d132 chore: Upgrade yaml v3 (#4172)
* 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>
2024-01-25 13:09:34 -05:00

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
}