Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.92k stars 397 forks source link

Trying to set a Draft config before init panics #836

Closed radu-matei closed 5 years ago

radu-matei commented 6 years ago

If you try to set a Draft config before executing draft init, this results in a panic:

$ draft config set key value
panic: assignment to entry in nil map

goroutine 1 [running]:
main.(*configSetCmd).run(0xc4204083c0, 0x0, 0x0)
        /go/src/github.com/Azure/draft/cmd/draft/config_set.go:44 +0x54
main.newConfigSetCmd.func2(0xc4204a3b00, 0xc4203f91a0, 0x2, 0x2, 0x0, 0x0)
        /go/src/github.com/Azure/draft/cmd/draft/config_set.go:28 +0x2a
github.com/Azure/draft/vendor/github.com/spf13/cobra.(*Command).execute(0xc4204a3b00, 0xc4203f90e0, 0x2, 0x2, 0xc4204a3b00, 0xc4203f90e0)
        /go/src/github.com/Azure/draft/vendor/github.com/spf13/cobra/command.go:698 +0x47a
github.com/Azure/draft/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc420455b00, 0xc42000c010, 0xc420455b00, 0xc420737f70)
        /go/src/github.com/Azure/draft/vendor/github.com/spf13/cobra/command.go:783 +0x30e
github.com/Azure/draft/vendor/github.com/spf13/cobra.(*Command).Execute(0xc420455b00, 0x0, 0x0)
        /go/src/github.com/Azure/draft/vendor/github.com/spf13/cobra/command.go:736 +0x2b
main.main()
        /go/src/github.com/Azure/draft/cmd/draft/draft.go:178 +0x2d

We should handle this and not panic.

bacongobbler commented 6 years ago

I believe this was resolved via https://github.com/Azure/draft/pull/828. Would you mind confirming? :)

radu-matei commented 5 years ago

Yes, my bad - building off master solves the issue. Closing this, thanks!