helm-docs
helm-docs copied to clipboard
Malformed comments result in hard to read error.
when I added a value with a comment (for description) I made a mistake.
#-- This is breaking
foo: bar
Resulted in
panic: runtime error: index out of range [1] with length 0
goroutine 8 [running]:
github.com/norwoodj/helm-docs/pkg/helm.ParseComment(0xc0001e7c30, 0x1, 0x1, 0xc0002a81c0, 0x2, 0x2, 0xc0001e7c30, 0x1, 0x1)
/home/runner/work/helm-docs/helm-docs/pkg/helm/comment.go:8 +0x2e5
github.com/norwoodj/helm-docs/pkg/document.getDescriptionFromNode(0xc0001dce60, 0xc00001f798, 0xc000001800, 0xc000001888, 0xc00006b490)
/home/runner/work/helm-docs/helm-docs/pkg/document/values.go:137 +0xf5
github.com/norwoodj/helm-docs/pkg/document.createValueRowsFromField(0xc0001e8dc0, 0xc, 0xc0001dce60, 0xc0001dcf00, 0xc0001b68a0, 0x1, 0x14a36fe, 0x1, 0x12, 0x10068a6, ...)
/home/runner/work/helm-docs/helm-docs/pkg/document/values.go:309 +0x305
github.com/norwoodj/helm-docs/pkg/document.createValueRowsFromObject(0x0, 0x0, 0x0, 0xc0001dcdc0, 0xc0001b68a0, 0x1, 0x1299045, 0xc00029f400, 0x203000, 0x100d470, ...)
/home/runner/work/helm-docs/helm-docs/pkg/document/values.go:282 +0x6f0
github.com/norwoodj/helm-docs/pkg/document.createValueRowsFromField(0x0, 0x0, 0x0, 0xc0001dcdc0, 0xc0001b68a0, 0x1, 0xc0001ded00, 0xc0001733e8, 0x1296b6f, 0xc0001733f8, ...)
/home/runner/work/helm-docs/helm-docs/pkg/document/values.go:303 +0x152
github.com/norwoodj/helm-docs/pkg/document.getSortedValuesTableRows(0xc0001dcdc0, 0xc0001b68a0, 0x108f14c1cc19b1e5, 0x100000c00011ea00, 0x1000000000000030, 0x0, 0x108f14c1cc19b1e5)
/home/runner/work/helm-docs/helm-docs/pkg/document/model.go:32 +0x65
github.com/norwoodj/helm-docs/pkg/document.getChartTemplateData(0xc000015ba8, 0x2, 0xc000015c6a, 0x5, 0x0, 0x0, 0xc000015be0, 0x7, 0x0, 0xc000017780, ...)
/home/runner/work/helm-docs/helm-docs/pkg/document/model.go:85 +0xcb
github.com/norwoodj/helm-docs/pkg/document.PrintDocumentation(0xc000015ba8, 0x2, 0xc000015c6a, 0x5, 0x0, 0x0, 0xc000015be0, 0x7, 0x0, 0xc000017780, ...)
/home/runner/work/helm-docs/helm-docs/pkg/document/generate.go:44 +0x2bc
main.retrieveInfoAndPrintDocumentation(0x148a265, 0x1, 0xc00001c7c0, 0x33, 0xc00000d020, 0x2, 0x2, 0xc000015b80, 0x6010100)
/home/runner/work/helm-docs/helm-docs/cmd/helm-docs/main.go:26 +0x2d5
created by main.helmDocs
/home/runner/work/helm-docs/helm-docs/cmd/helm-docs/main.go:69 +0x4f1
This was very hard to sort out what I did wrong. This was very hard to debug
make sure there is a space between the hashtag and the dashes # --
I think @beaujos-jhancock was just asking for more informative error logs.
I had another case (missing line break between two comments)
# -- tmp dir configuration.
tmpDir: {}
# -- tmpDir.sizeLimit -- Optional size limit
#sizeLimit: 10M
# -- logs dir configuration.
logsDir: {}
# -- logsDir.sizeLimit -- Optional size limit
#sizeLimit: 100M
which resulted in
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x1306523]
goroutine 37 [running]:
github.com/norwoodj/helm-docs/pkg/document.createValueRowsFromObject({0x0, 0x0}, 0x0, 0xc0001fa500, 0xc0002fc347?, 0x1)
/home/runner/work/helm-docs/helm-docs/pkg/document/values.go:315 +0x4a3
github.com/norwoodj/helm-docs/pkg/document.createValueRowsFromField({0x0?, 0xc0003a3310?}, 0x12a406e?, 0xc0002a2040?, 0xc0002a2040?, 0x0?)
/home/runner/work/helm-docs/helm-docs/pkg/document/values.go:384 +0x4e
github.com/norwoodj/helm-docs/pkg/document.getUnsortedValueRows(0x0?, 0xc0002a2058?)
/home/runner/work/helm-docs/helm-docs/pkg/document/model.go:92 +0xd0
github.com/norwoodj/helm-docs/pkg/document.getChartTemplateData({{{0xc0001aa528, 0x2}, {0x0, 0x0}, {0x0, 0x0}, {0xc0001aa580, 0xd}, 0x0, {0xc000014858, ...}, ...}, ...}, ...)
/home/runner/work/helm-docs/helm-docs/pkg/document/model.go:96 +0x8e
github.com/norwoodj/helm-docs/pkg/document.PrintDocumentation({{{0xc0001aa528, 0x2}, {0x0, 0x0}, {0x0, 0x0}, {0xc0001aa580, 0xd}, 0x0, {0xc000014858, ...}, ...}, ...}, ...)
/home/runner/work/helm-docs/helm-docs/pkg/document/generate.go:44 +0x285
main.writeDocumentation.func1({0x133db20?, 0xc0001f8ee0?})
/home/runner/work/helm-docs/helm-docs/cmd/helm-docs/main.go:143 +0x208
main.parallelProcessIterable.func1()
/home/runner/work/helm-docs/helm-docs/cmd/helm-docs/main.go:34 +0x87
created by main.parallelProcessIterable
/home/runner/work/helm-docs/helm-docs/cmd/helm-docs/main.go:31 +0x87
Would be nice not have more information e.g. about the location of the error.
Sorry by the late response. I will look into it this weekend.