From 5731be4590ab01d66a8956e8548031e25b5e3b4d Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 15 Nov 2024 08:57:25 +1300 Subject: [PATCH] chore: enable `gochecknoinits` linter --- .golangci.yaml | 2 +- binary/cdx/cdx_test.go | 1 + detector/list/list.go | 1 + extractor/filesystem/list/list.go | 1 + extractor/standalone/list/list.go | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.golangci.yaml b/.golangci.yaml index c5b394f9..52aa4126 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -31,7 +31,7 @@ linters: # - forbidigo - ginkgolinter - gocheckcompilerdirectives -# - gochecknoinits + - gochecknoinits - gochecksumtype # - gocritic # - gofmt diff --git a/binary/cdx/cdx_test.go b/binary/cdx/cdx_test.go index deb8d57d..6f40d00b 100644 --- a/binary/cdx/cdx_test.go +++ b/binary/cdx/cdx_test.go @@ -28,6 +28,7 @@ import ( var doc *cyclonedx.BOM +//nolint:gochecknoinits func init() { doc = cyclonedx.NewBOM() doc.Metadata = &cyclonedx.Metadata{ diff --git a/detector/list/list.go b/detector/list/list.go index 24191886..bca065d4 100644 --- a/detector/list/list.go +++ b/detector/list/list.go @@ -68,6 +68,7 @@ var detectorNames = map[string][]detector.Detector{ "all": All, } +//nolint:gochecknoinits func init() { for _, d := range All { register(d) diff --git a/extractor/filesystem/list/list.go b/extractor/filesystem/list/list.go index 8d838d1d..a2e9c189 100644 --- a/extractor/filesystem/list/list.go +++ b/extractor/filesystem/list/list.go @@ -178,6 +178,7 @@ var ( // LINT.ThenChange(/docs/supported_inventory_types.md) +//nolint:gochecknoinits func init() { for _, e := range All { register(e) diff --git a/extractor/standalone/list/list.go b/extractor/standalone/list/list.go index dc9eca6a..2c218ac6 100644 --- a/extractor/standalone/list/list.go +++ b/extractor/standalone/list/list.go @@ -66,6 +66,7 @@ var ( } ) +//nolint:gochecknoinits func init() { for _, e := range All { register(e)