changelog: Do not add to a nil map #252
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initialize a nil map before writing to it.
From https://github.com/cilium/cilium/actions/runs/10349027982/job/28642554669:
panic: assignment to entry in nil map
goroutine 1 [running]:
github.com/cilium/release/cmd/changelog.(*ChangeLog).PrintReleaseNotesForWriter(0xc0005f6270, {0xb0e140, 0xc0003a4090})
/home/runner/work/cilium/release/cmd/changelog/generate.go:181 +0x170e
github.com/cilium/release/cmd/release.(*PrepareCommit).generateChangeLog(0xc000058128, {0xb12260, 0xc00007cb90}, 0xc0001e2b90)
/home/runner/work/cilium/release/cmd/release/git.go:244 +0x40c
github.com/cilium/release/cmd/release.(*PrepareCommit).Run(0xc000058128, {0xb12260, 0xc00007cb90}, 0x5f?, 0x25?, 0xc0001e2b90)
/home/runner/work/cilium/release/cmd/release/git.go:139 +0xc65
github.com/cilium/release/cmd/release.Command.func2(0xc000193208, {0xa39d47?, 0x4?, 0xa39d4b?})
/home/runner/work/cilium/release/cmd/release/start.go:288 +0x98c
github.com/spf13/cobra.(*Command).execute(0xc000193208, {0xc00011e840, 0xb, 0xb})
/home/runner/work/cilium/release/vendor/github.com/spf13/cobra/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xefc780)
/home/runner/work/cilium/release/vendor/github.com/spf13/cobra/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/work/cilium/release/vendor/github.com/spf13/cobra/command.go:1039
main.main()
/home/runner/work/cilium/release/cmd/main.go:115 +0x1a