Skip to content

"changelog fmt" panics on bad formatting #76

@invidian

Description

@invidian

Given following malformed changelog:

$ cat CHANGELOG.md
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0] - 2020-08-31

### Changed

- e2e: Updated used sonobuoy version to v0.19.0.
- e2e/local-testing: use Terraform 0.13.
- Default Kubernetes version is now v1.19.0.
- As upstream Kubernetes deprecated hyperkube image, now each controlplane component
  use individual images. As upstream does not publish kubelet images yet, new default kubelet image
  is build from [kubelet](https://github.com/flexkube/kubelet) repository and available for pulling
  from `quay.io/flexkube/kubelet` registry.
- controlplane: static kube-apiserver now runs on host network and with `--permit-port-sharing=true`
  flag set to make use of binding with SO_REUSEPORT option, which eliminates the need of bootstrap
  HAProxy and HAProxy container on self-hosted kube-apiserver pods.
- e2e: use Helm v3.3.0.
- Updated Go dependencies to latest versions.

### Removed

- e2e: Remove bootstrap API Load Balancer - it is no longer needed as since Kubernetes v1.19.0,
  kube-apiserver is able to bind with SO_REUSEPORT, if `--permit-port-sharing=true` flag is set.
## [0.3.3] - 2020-08-29

changelog panics with the following error:

$ changelog fmt
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x52e763]

goroutine 1 [running]:
github.com/rcmachado/changelog/parser.(*renderer).ListItem(0xc000022720, 0x6635c0, 0xc00007cd50, 0xc0001883c0, 0x1, 0x1)
        /home/invidian/go/pkg/mod/github.com/rcmachado/changelog@v0.0.0-20200703205747-24a2e26bdaaa/parser/parser.go:189 +0x143
github.com/rcmachado/changelog/parser.(*renderer).RenderNode(0xc000022720, 0x6635c0, 0xc00007cd50, 0xc0001883c0, 0xc00012a601, 0x0)
        /home/invidian/go/pkg/mod/github.com/rcmachado/changelog@v0.0.0-20200703205747-24a2e26bdaaa/parser/parser.go:84 +0xe5
github.com/russross/blackfriday/v2.Run.func1(0xc0001883c0, 0x40ea01, 0x0)
        /home/invidian/go/pkg/mod/github.com/russross/blackfriday/v2@v2.0.1/markdown.go:392 +0x5a
github.com/russross/blackfriday/v2.(*Node).Walk(0xc00012a640, 0xc000151c00)
        /home/invidian/go/pkg/mod/github.com/russross/blackfriday/v2@v2.0.1/node.go:284 +0x63
github.com/russross/blackfriday/v2.Run(0xc00013c000, 0x52c, 0xe00, 0xc000151cb0, 0x2, 0x2, 0x0, 0x0, 0x0)
        /home/invidian/go/pkg/mod/github.com/russross/blackfriday/v2@v2.0.1/markdown.go:391 +0x26d
github.com/rcmachado/changelog/parser.Parse(0x663580, 0xc0000226c0, 0x0)
        /home/invidian/go/pkg/mod/github.com/rcmachado/changelog@v0.0.0-20200703205747-24a2e26bdaaa/parser/parser.go:26 +0x1e5
github.com/rcmachado/changelog/cmd.newFmtCmd.func1(0xc0001702c0, 0x7be188, 0x0, 0x0)
        /home/invidian/go/pkg/mod/github.com/rcmachado/changelog@v0.0.0-20200703205747-24a2e26bdaaa/cmd/fmt.go:14 +0x3b
github.com/spf13/cobra.(*Command).execute(0xc0001702c0, 0x7be188, 0x0, 0x0, 0xc0001702c0, 0x7be188)
        /home/invidian/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x789440, 0x44536a, 0x7735a0, 0xc000000180)
        /home/invidian/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/invidian/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
github.com/rcmachado/changelog/cmd.Execute()
        /home/invidian/go/pkg/mod/github.com/rcmachado/changelog@v0.0.0-20200703205747-24a2e26bdaaa/cmd/root.go:84 +0x31
main.main()
        /home/invidian/go/pkg/mod/github.com/rcmachado/changelog@v0.0.0-20200703205747-24a2e26bdaaa/main.go:6 +0x25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions