Drone panics when running drone convert
(through a webhook or the CLI) on a legacy document such as the following:
pipeline:
print-hello:
image: alpine
commands:
- echo helloworld
<<: *push
anchors:
push: &push
when:
event: push
I couldn’t reproduce the error on the vinzenz/yaml repository (master branch).
go run main.go convert failing-anchor.yml
panic: reflect.Value.Addr of unaddressable value [recovered]
panic: reflect.Value.Addr of unaddressable value
goroutine 1 [running]:
github.com/vinzenz/yaml.handleErr(0xc0001cd8b8)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/yaml.go:164 +0x9a
panic(0x12f6860, 0x13c5d50)
/usr/local/Cellar/go/1.13.1/libexec/src/runtime/panic.go:679 +0x1b2
reflect.Value.Addr(0x1309320, 0xc0002fa900, 0x15, 0x4, 0xc0002e8ee8, 0xc000221601)
/usr/local/Cellar/go/1.13.1/libexec/src/reflect/value.go:258 +0x96
github.com/vinzenz/yaml.(*decoder).alias(0xc0002da600, 0xc0002f47e0, 0x1309320, 0xc0002fa900, 0x15, 0xc0002e4a44)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:400 +0x646
github.com/vinzenz/yaml.(*decoder).unmarshal(0xc0002da600, 0xc0002f47e0, 0x1309320, 0xc0002fa900, 0x15, 0x1)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:343 +0x319
github.com/vinzenz/yaml.(*decoder).merge(0xc0002da600, 0xc0002f47e0, 0x1309320, 0xc0002fa900, 0x15)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:767 +0x248
github.com/vinzenz/yaml.(*decoder).mappingSlice(0xc0002da600, 0xc0002f44d0, 0x1303a60, 0xc0002215c0, 0x197, 0x197)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:687 +0x3fb
github.com/vinzenz/yaml.(*decoder).mapping(0xc0002da600, 0xc0002f44d0, 0x1308d20, 0xc000221590, 0x194, 0x1308d20)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:625 +0x96d
github.com/vinzenz/yaml.(*decoder).unmarshal(0xc0002da600, 0xc0002f44d0, 0x1308d20, 0xc000221590, 0x194, 0x194)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:354 +0x249
github.com/vinzenz/yaml.(*decoder).mappingSlice(0xc0002da600, 0xc0002f43f0, 0x1303a60, 0xc0002214e8, 0x197, 0xc0001cd280)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:697 +0x6c1
github.com/vinzenz/yaml.(*decoder).mapping(0xc0002da600, 0xc0002f43f0, 0x1303a60, 0xc0002214e8, 0x197, 0x1303a60)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:615 +0xa9c
github.com/vinzenz/yaml.(*decoder).unmarshal(0xc0002da600, 0xc0002f43f0, 0x1303a60, 0xc0002214e8, 0x197, 0xc0002214e8)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:354 +0x249
github.com/vinzenz/yaml.(*decoder).mappingStruct(0xc0002da600, 0xc0002f4310, 0x1324560, 0xc0002214e0, 0x199, 0x0)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:739 +0x9ae
github.com/vinzenz/yaml.(*decoder).mapping(0xc0002da600, 0xc0002f4310, 0x1324560, 0xc0002214e0, 0x199, 0x1324560)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:613 +0xa43
github.com/vinzenz/yaml.(*decoder).unmarshal(0xc0002da600, 0xc0002f4310, 0x1324560, 0xc0002214e0, 0x199, 0xc0002f2580)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:354 +0x249
github.com/vinzenz/yaml.(*decoder).document(0xc0002da600, 0xc0002f42a0, 0x1324560, 0xc0002214e0, 0x199, 0xc0002f42a0)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:370 +0x7c
github.com/vinzenz/yaml.(*decoder).unmarshal(0xc0002da600, 0xc0002f42a0, 0x1324560, 0xc0002214e0, 0x199, 0x199)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/decode.go:338 +0x372
github.com/vinzenz/yaml.unmarshal(0xc000304000, 0x95, 0x600, 0x12e5040, 0xc0002214e0, 0x20300000000000, 0x0, 0x0)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/yaml.go:101 +0x25b
github.com/vinzenz/yaml.Unmarshal(...)
/Users/ndrummond/go/pkg/mod/github.com/vinzenz/yaml@v0.0.0-20170920082545-91409cdd725d/yaml.go:80
github.com/drone/drone-yaml/yaml/converter/legacy/internal.expandMergeKeys(0xc000304000, 0x95, 0x600, 0xc0001cd92d, 0x3, 0x3, 0x57, 0x0)
/Users/ndrummond/projects/drone-yaml/yaml/converter/legacy/internal/yaml.go:21 +0x73
github.com/drone/drone-yaml/yaml/converter/legacy/internal.Convert(0xc000304000, 0x95, 0x600, 0x0, 0x0, 0xc0002fe2d0, 0x1, 0xa, 0x95, 0x600)
/Users/ndrummond/projects/drone-yaml/yaml/converter/legacy/internal/config.go:49 +0x299b
github.com/drone/drone-yaml/yaml/converter/legacy.Convert(...)
/Users/ndrummond/projects/drone-yaml/yaml/converter/legacy/convert.go:12
github.com/drone/drone-yaml/yaml/converter.Convert(0xc000304000, 0x95, 0x600, 0x7ffeefbff7c1, 0x12, 0x0, 0x0, 0x0, 0x0, 0x1, ...)
/Users/ndrummond/projects/drone-yaml/yaml/converter/convert.go:32 +0xe9
main.runConvert(0x1367fde, 0x1367fde)
/Users/ndrummond/projects/drone-yaml/main.go:113 +0x11a
main.main()
/Users/ndrummond/projects/drone-yaml/main.go:74 +0x29f
exit status 2