Skip to content

Fix Workhorse linter warnings (part 23)

Problem

make golangci linter detects warnings in following Workhorse files

How to verify

make golangci | grep -E "^internal/senddata"
internal/senddata/contentprocessor/contentprocessor.go:125:15: Error return value of `cd.FlushError` is not checked (errcheck)
internal/senddata/contentprocessor/contentprocessor.go:134:35: response body must be closed (bodyclose)
internal/senddata/contentprocessor/contentprocessor.go:1:1: package-comments: should have a package comment (revive)
internal/senddata/contentprocessor/contentprocessor_test.go:16:18: string `Hello world!` has 3 occurrences, make it a constant (goconst)
internal/senddata/contentprocessor/contentprocessor_test.go:181:23: response body must be closed (bodyclose)
internal/senddata/contentprocessor/contentprocessor_test.go:220:23: response body must be closed (bodyclose)
internal/senddata/contentprocessor/contentprocessor_test.go:238:21: response body must be closed (bodyclose)
internal/senddata/contentprocessor/contentprocessor_test.go:23:21: response body must be closed (bodyclose)
internal/senddata/contentprocessor/contentprocessor_test.go:254:21: response body must be closed (bodyclose)
internal/senddata/contentprocessor/contentprocessor_test.go:270:21: response body must be closed (bodyclose)
internal/senddata/contentprocessor/contentprocessor_test.go:298:2: bool-compare: use require.True (testifylint)
internal/senddata/contentprocessor/contentprocessor_test.go:32:21: response body must be closed (bodyclose)
internal/senddata/injecter.go:10:6: exported: exported type Injecter should have comment or be unexported (revive)
internal/senddata/injecter.go:16:6: exported: exported type Prefix should have comment or be unexported (revive)
internal/senddata/injecter.go:18:1: exported: exported method Prefix.Match should have comment or be unexported (revive)
internal/senddata/injecter.go:1:1: package-comments: should have a package comment (revive)
internal/senddata/injecter.go:22:1: exported: exported method Prefix.Unpack should have comment or be unexported (revive)
internal/senddata/injecter.go:27:33: unnecessary conversion (unconvert)
internal/senddata/injecter.go:33:1: exported: exported method Prefix.Name should have comment or be unexported (revive)
internal/senddata/senddata.go:1:1: ST1000: at least one file in a package should have a package comment (stylecheck)
internal/senddata/senddata.go:40:1: exported: exported function SendData should have comment or be unexported (revive)
internal/senddata/writer_test.go:44:4: len: use require.Len (testifylint)
internal/senddata/writer_test.go:65:55: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)

Solution

Resolve warnings

Edited by Vasilii Iakliushin