Open
Description
It appears that when parsing a URL from the environment, serpent does not dereference it properly when embedded in a struct:
FROBNICATE_URL=http://foo.bar go run main.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10083be74]
goroutine 1 [running]:
github.com/coder/serpent.(*URL).Set(0x0, {0x1400001608f?, 0x100849e0a?})
/Users/cian/go/pkg/mod/github.com/coder/[email protected]/values.go:277 +0x34
github.com/coder/serpent.(*OptionSet).ParseEnv(0x140000ba280, {0x1400027a000, 0x23, 0x10064b324?})
/Users/cian/go/pkg/mod/github.com/coder/[email protected]/option.go:287 +0x240
github.com/coder/serpent.(*Invocation).run(0x140001d4200, 0x1400025fca8)
/Users/cian/go/pkg/mod/github.com/coder/[email protected]/command.go:289 +0x58
github.com/coder/serpent.(*Invocation).Run(0x140001d4200)
/Users/cian/go/pkg/mod/github.com/coder/[email protected]/command.go:536 +0x128
main.main()
/Users/cian/tmp/serpent-url-panic/main.go:40 +0x268
exit status 2
Sample Go program to reproduce: https://go.dev/play/p/K9uNgbvGM0J