Skip to content

Fix errorlint violations and re-enable it #333

@bom-d-van

Description

@bom-d-van

When I upgraded golangci-lint to version v1.40.1 in this PR, there are many errorlint issues reported. As they are not introduced by my changes. I decided to temporarily disable errorlint and filed a ticket here as reference.

$ golangci-lint run
WARN [runner] The linter 'scopelint' is deprecated (since v1.39.0) due to: The repository of the linter has been deprecated by the owner.  Replaced by exportloopref.
expr/functions/cairo/png/pixel_ratio.go:75:12: cannot use &(pixelRatioContext literal) (value of type *pixelRatioContext) as cairoContext value in struct literal: missing method AppendPath (typecheck)
		context: &pixelRatioContext{
		         ^
app/carbonzipper/http_handlers.go:638:16: type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
			if _, ok := e.(types.ErrNotFound); !ok {
			            ^
cache/cache.go:99:6: comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
		if err == memcache.ErrCacheMiss {
		   ^
cache/cache.go:217:6: comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
		if err == memcache.ErrCacheMiss {
		   ^
cache/cache_test.go:68:5: comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
	if err != ErrNotFound {
	   ^
cache/cache_test.go:96:5: comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
	if err != ErrTimeout {
	   ^
expr/functions/aliasSub/function.go:50:79: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
		return nil, fmt.Errorf("%w: %s %v", parser.ErrInvalidArgumentValue, search, err)
		                                                                            ^
expr/functions/exclude/function.go:46:76: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
		return nil, fmt.Errorf("%w: %s %v", parser.ErrInvalidArgumentValue, pat, err)
		                                                                         ^
expr/functions/grep/function.go:46:76: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
		return nil, fmt.Errorf("%w: %s %v", parser.ErrInvalidArgumentValue, pat, err)
		                                                                         ^
expr/helper/helper.go:63:20: comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
		if err != nil && err != parser.ErrSeriesDoesNotExist {
		                 ^
pkg/backend/net/net.go:297:18: type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
		if code, ok := err.(ErrHTTPCode); ok && code == http.StatusNotFound {
		               ^

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions