diff --git a/go.mod b/go.mod index ea04c5d18e83a..01c55ce1a87c6 100644 --- a/go.mod +++ b/go.mod @@ -180,7 +180,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 ) @@ -207,3 +207,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 b5c80af189f50..ad3f114fa93f0 100644 --- a/go.sum +++ b/go.sum @@ -1207,6 +1207,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-20200714221025-dea986a54d01 h1:Qp+BmPgBkC4e0J5hAXS+UpdoPhQTkCrxYxkoyrxQ1nI= github.com/sourcegraph/zoekt v0.0.0-20200714221025-dea986a54d01/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 d8ee6120f8c59..5c238559c0a98 100644 --- a/internal/campaigns/types.go +++ b/internal/campaigns/types.go @@ -25,6 +25,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 @@ -1675,7 +1677,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 55131750932ad..4b41a3b66d253 100644 --- a/internal/campaigns/types_test.go +++ b/internal/campaigns/types_test.go @@ -1120,7 +1120,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: