Skip to content

Specifying imports without any items throws unfriendly error #96

@williamayerst

Description

@williamayerst

If one includes a block like so:

import:
# nothing

tasks:
 blabla

Then an error is generated like the below:

panic: interface conversion: interface {} is nil, not []interface {}

goroutine 1 [running]:
github.com/taskctl/taskctl/internal/config.(*Loader).load(0xc00008db30, 0xc000026460, 0x20, 0x0, 0x0, 0x0)
	/home/runner/work/taskctl/taskctl/internal/config/loader.go:155 +0xa1f
github.com/taskctl/taskctl/internal/config.(*Loader).Load(0xc00008db30, 0xc000026460, 0x20, 0x0, 0x0, 0xc05170)
	/home/runner/work/taskctl/taskctl/internal/config/loader.go:74 +0x10d
main.makeApp.func2(0xc00007e580, 0xb, 0x12)
	/home/runner/work/taskctl/taskctl/cmd/taskctl/taskctl.go:138 +0x8a
github.com/urfave/cli/v2.(*App).RunContext(0xc0000b0480, 0x9be810, 0xc0000a8010, 0xc0000b4000, 0x2, 0x2, 0x0, 0x0)
	pkg/mod/github.com/urfave/cli/v2@v2.2.0/app.go:291 +0x882
github.com/urfave/cli/v2.(*App).Run(...)
	pkg/mod/github.com/urfave/cli/v2@v2.2.0/app.go:215
main.run(0xc0000ba000, 0x9b6ca0)
	/home/runner/work/taskctl/taskctl/cmd/taskctl/taskctl.go:65 +0xaf
main.main()
	/home/runner/work/taskctl/taskctl/cmd/taskctl/taskctl.go:42 +0x73
##[error]Bash exited with code '2'.

Easy to figure out since that was my only change, but I wonder if there's a kinder way to surface this error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions