siderolabs/conform

panic if commit message is empty

donbowman opened this issue · 1 comments

conform enforce --commit-msg-file /dev/null
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/autonomy/conform/internal/policy/commit.firstWord(0x0, 0x0, 0x0, 0x200)
	/home/don/go/src/github.com/autonomy/conform/internal/policy/commit/commit.go:215 +0x135
github.com/autonomy/conform/internal/policy/commit.(*Commit).Compliance(0xc0001f0560, 0xc0000107b8, 0x0, 0x0, 0x0)
	/home/don/go/src/github.com/autonomy/conform/internal/policy/commit/commit.go:107 +0x3c2
github.com/autonomy/conform/internal/enforcer.(*Conform).enforce(0xc0001f0900, 0xc0001f0a00, 0xc0000107b8, 0x1, 0x1, 0x17)
	/home/don/go/src/github.com/autonomy/conform/internal/enforcer/enforcer.go:96 +0x1e5
github.com/autonomy/conform/internal/enforcer.(*Conform).Enforce(0xc0001f0900, 0xc0000107b0, 0x1, 0x1)
	/home/don/go/src/github.com/autonomy/conform/internal/enforcer/enforcer.go:66 +0x1b3
github.com/autonomy/conform/cmd.glob..func1(0x16964c0, 0xc0001f0820, 0x0, 0x2)
	/home/don/go/src/github.com/autonomy/conform/cmd/enforce.go:41 +0x1ac
github.com/spf13/cobra.(*Command).execute(0x16964c0, 0xc0001f07e0, 0x2, 0x2, 0x16964c0, 0xc0001f07e0)
	/home/don/go/src/github.com/spf13/cobra/command.go:766 +0x2ae
github.com/spf13/cobra.(*Command).ExecuteC(0x1696720, 0x1, 0x0, 0x0)
	/home/don/go/src/github.com/spf13/cobra/command.go:852 +0x2c0
github.com/spf13/cobra.(*Command).Execute(...)
	/home/don/go/src/github.com/spf13/cobra/command.go:800
github.com/autonomy/conform/cmd.Execute()
	/home/don/go/src/github.com/autonomy/conform/cmd/root.go:32 +0x32
main.main()
	/home/don/go/src/github.com/autonomy/conform/main.go:10 +0x20

Hey @donbowman. Sorry, I somehow missed this issue. Thanks for the bug report. I can have this fixed in the next release.