Fix Workhorse linter warnings (part 25)
Problem
make golangci linter detects warnings in following Workhorse files
How to verify
make golangci | grep -E "^internal/staticpages"
internal/staticpages/deploy_page.go:13:16: G304: Potential file inclusion via variable (gosec)
internal/staticpages/deploy_page.go:1:1: package-comments: should have a package comment (revive)
internal/staticpages/deploy_page.go:22:10: Error return value of `w.Write` is not checked (errcheck)
internal/staticpages/deploy_page.go:9:1: exported: exported method Static.DeployPage should have comment or be unexported (revive)
internal/staticpages/error_pages.go:126:1: exported: exported method Static.ErrorPagesUnless should have comment or be unexported (revive)
internal/staticpages/error_pages.go:1:1: ST1000: at least one file in a package should have a package comment (stylecheck)
internal/staticpages/error_pages.go:22:6: exported: exported type ErrorFormat should have comment or be unexported (revive)
internal/staticpages/error_pages.go:25:2: exported: exported const ErrorFormatHTML should have comment (or a comment on this block) or be unexported (revive)
internal/staticpages/error_pages.go:88:12: Error return value of `s.rw.Write` is not checked (errcheck)
internal/staticpages/error_pages.go:96:19: G304: Potential file inclusion via variable (gosec)
internal/staticpages/error_pages_test.go:141:3: len: use require.Len (testifylint)
internal/staticpages/error_pages_test.go:161:3: len: use require.Len (testifylint)
internal/staticpages/error_pages_test.go:175:34: response body must be closed (bodyclose)
internal/staticpages/error_pages_test.go:19:15: string `ERROR` has 5 occurrences, make it a constant (goconst)
internal/staticpages/error_pages_test.go:28:3: len: use require.Len (testifylint)
internal/staticpages/error_pages_test.go:63:17: string `Interesting Server Error` has 3 occurrences, make it a constant (goconst)
internal/staticpages/servefile.go:19:6: exported: exported type CacheMode should have comment or be unexported (revive)
internal/staticpages/servefile.go:1:1: ST1000: at least one file in a package should have a package comment (stylecheck)
internal/staticpages/servefile.go:22:2: exported: exported const CacheDisabled should have comment (or a comment on this block) or be unexported (revive)
internal/staticpages/servefile.go:26: internal/staticpages/servefile.go:26: Line contains TODO/BUG/FIXME/NOTE/OPTIMIZE/HACK: "BUG/QUIRK: If a client requests 'foo%2Fb..." (godox)
internal/staticpages/servefile.go:29: Function 'ServeExisting' is too long (62 > 60) (funlen)
internal/staticpages/servefile.go:32:22: wrapperFunc: use http.NotFoundHandler method in `http.HandlerFunc(http.NotFound)` (gocritic)
internal/staticpages/servefile.go:73:22: Error return value of `content.Close` is not checked (errcheck)
internal/staticpages/servefile.go:75:3: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
internal/staticpages/servefile_test.go:18:9: string `/path/to/non/existing/directory` has 3 occurrences, make it a constant (goconst)
internal/staticpages/static.go:1:1: ST1000: at least one file in a package should have a package comment (stylecheck)
internal/staticpages/static.go:5:6: exported: exported type Static should have comment or be unexported (revive)
Solution
Resolve warnings
Edited by Vasilii Iakliushin