Both these Taskfiles cause task to panic:
version: '2'
tasks:
foo:
and (so default is not a special case)
version: '2'
tasks:
default:
Panic is:
$ task
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x12cf3e1]
goroutine 1 [running]:
github.com/go-task/task/v2/internal/taskfile/read.Taskfile(0x0, 0x0, 0x139e0cb, 0xc, 0xc000060460, 0x5, 0x5)
/home/runner/work/task/task/internal/taskfile/read/taskfile.go:64 +0x5c1
github.com/go-task/task/v2.(*Executor).Setup(0xc00007c2c0, 0xc00007c2c0, 0x0)
/home/runner/work/task/task/task.go:109 +0x89
main.main()
/home/runner/work/task/task/cmd/task/task.go:135 +0x989
Happening with task 2.8.1 on macOS.
I'm not sure why someone would write an empty task.
Seems worth fixing it though, since it'd be pretty easy.
I'm not sure why someone would write an empty task.
By mistake :-)
I had a partially commented-out task, which resulted in the equivalent of the reproduction case I added in the issue.
To me, any crash, especially with a so simple input, deserves an attempt to be fixed :-)
I can work on this :)
Fixed on d78f78bb5cdd94fec59244121bdc1130547beb2b
thanks!
Most helpful comment
By mistake :-)
I had a partially commented-out task, which resulted in the equivalent of the reproduction case I added in the issue.
To me, any crash, especially with a so simple input, deserves an attempt to be fixed :-)