diff --git a/go.mod b/go.mod index de1394948f98..1f26fc3fc577 100644 --- a/go.mod +++ b/go.mod @@ -179,7 +179,7 @@ require ( gopkg.in/square/go-jose.v2 v2.5.1 // indirect gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.3.0 - gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect + gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 honnef.co/go/tools v0.0.1-2020.1.4 // indirect ) @@ -204,3 +204,6 @@ replace github.com/russross/blackfriday => github.com/russross/blackfriday v1.5. replace github.com/dghubble/gologin => github.com/sourcegraph/gologin v1.0.2-0.20181110030308-c6f1b62954d8 replace github.com/golang/lint => golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f + +// See: https://github.com/ghodss/yaml/pull/65 +replace github.com/ghodss/yaml => github.com/sourcegraph/yaml v1.0.1-0.20200714132230-56936252f152 diff --git a/go.sum b/go.sum index 5ec649c98821..8c18fe9f5b88 100644 --- a/go.sum +++ b/go.sum @@ -1209,6 +1209,8 @@ github.com/sourcegraph/jsonx v0.0.0-20200625022044-c22a595bbad7 h1:G58fa9uWw59V5 github.com/sourcegraph/jsonx v0.0.0-20200625022044-c22a595bbad7/go.mod h1:7jkSQ2sdxwXMaIDxKJotTt+hwKnT9b/wbJFU7/ObUEY= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG93cPwA5f7s/ZPBJnGOYQNK/vKsaDaseuKT5Asee8= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/sourcegraph/yaml v1.0.1-0.20200714132230-56936252f152 h1:z/MpntplPaW6QW95pzcAR/72Z5TWDyDnSo0EOcyij9o= +github.com/sourcegraph/yaml v1.0.1-0.20200714132230-56936252f152/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= github.com/sourcegraph/zoekt v0.0.0-20200622101713-7b13614a083e h1:g7164BqqH/2SXaWaUjHtgUL3808yFfrbnKZ/JiWmiTI= github.com/sourcegraph/zoekt v0.0.0-20200622101713-7b13614a083e/go.mod h1:WleTVLMEfvGF6uZ/mSWXVUH1H4NPxAcu6YbJ0TORdWc= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ= diff --git a/internal/campaigns/types.go b/internal/campaigns/types.go index 9669c5f7aefe..67002733bb44 100644 --- a/internal/campaigns/types.go +++ b/internal/campaigns/types.go @@ -24,6 +24,8 @@ import ( "github.com/sourcegraph/sourcegraph/internal/vcs/git" "github.com/sourcegraph/sourcegraph/schema" "github.com/xeipuuv/gojsonschema" + + yamlv3 "gopkg.in/yaml.v3" ) // SupportedExternalServices are the external service types currently supported @@ -1541,7 +1543,7 @@ func (cs *CampaignSpec) UnmarshalValidate() error { return errors.Wrap(err, "failed to compile CampaignSpec JSON schema") } - normalized, err := yaml.YAMLToJSON([]byte(cs.RawSpec)) + normalized, err := yaml.YAMLToJSONCustom([]byte(cs.RawSpec), yamlv3.Unmarshal) if err != nil { return errors.Wrapf(err, "failed to normalize JSON") } diff --git a/internal/campaigns/types_test.go b/internal/campaigns/types_test.go index a52c53d0d037..36e207280b23 100644 --- a/internal/campaigns/types_test.go +++ b/internal/campaigns/types_test.go @@ -562,7 +562,7 @@ func TestCampaignSpecUnmarshalValidate(t *testing.T) { rawSpec: ` name: my-unique-name description: My description -'on': +on: - repositoriesMatchingQuery: lang:go func main - repository: github.com/sourcegraph/src-cli steps: