Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Oct 11, 2024
1 parent 9065114 commit 9b8c476
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 37 deletions.
62 changes: 29 additions & 33 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
run:
deadline: 6m

skip-files:
- "zz_generated\\..+\\.go$"

skip-dirs:
- vendor$
timeout: 6m

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
formats:
- format: colored-line-number

linters-settings:
errcheck:
Expand All @@ -21,19 +16,15 @@ linters-settings:
# default is false: such cases aren't reported by default.
check-blank: false

# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,io/ioutil:^Read.*
# report about not checking of errors in assignments: `num, err := strconv.Atoi(numStr)`;
exclude-functions:
- fmt:.*
- io/ioutil:^Read.*

govet:
# report about shadowed variables
check-shadowing: false

golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8

gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
Expand All @@ -47,10 +38,6 @@ linters-settings:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10

maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true

dupl:
# tokens count to trigger issue, 150 by default
threshold: 100
Expand Down Expand Up @@ -109,35 +96,39 @@ linters-settings:
severity: warning
confidence: 0.8


linters:
enable:
- megacheck
- govet
- gocyclo
- gocritic
- gosimple
- staticcheck
- unused
- goconst
- goimports
- gofmt # We enable this as well as goimports for its simplify mode.
- gofmt # We enable this as well as goimports for its simplify mode.
- prealloc
- revive
- unconvert
- misspell
- nakedret
- exportloopref
- copyloopvar
- gosec

disable:
- scopelint
- errcheck

presets:
- bugs
- unused
fast: false


issues:
exclude-files:
- "zz_generated\\..+\\.go$"
exclude-dirs:
- vendor$

exclude:
- "G103: Use of unsafe calls should be audited"

Expand All @@ -164,31 +155,36 @@ issues:
# rather than using a pointer.
- text: "(hugeParam|rangeValCopy):"
linters:
- gocritic
- gocritic

# This "TestMain should call os.Exit to set exit code" warning is not clever
# enough to notice that we call a helper method that calls os.Exit.
- text: "SA3000:"
linters:
- staticcheck
- staticcheck

- text: "k8s.io/api/core/v1"
linters:
- goimports
- goimports

# This is a "potential hardcoded credentials" warning. It's triggered by
# any variable with 'secret' in the same, and thus hits a lot of false
# positives in Kubernetes land where a Secret is an object type.
- text: "G101:"
linters:
- gosec
- gas
- gosec
- gas

# This is an 'errors unhandled' warning that duplicates errcheck.
- text: "G104:"
linters:
- gosec
- gas
- gosec
- gas

- text: "G115:"
linters:
- gosec
- gas

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
Expand Down
6 changes: 2 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,12 @@ func (s *Client) Request(ctx context.Context) (*http.Request, error) {
return nil, err
}
}
req, err := http.NewRequest(s.method, reqURL.String(), body)
req, err := http.NewRequestWithContext(ctx, s.method, reqURL.String(), body)
if err != nil {
return nil, err
}
addHeaders(req, s.header)

req = req.WithContext(ctx)

if s.signer != nil {
err = s.signer.Sign(req)
if err != nil {
Expand Down Expand Up @@ -392,7 +390,7 @@ func (s *Client) ReceiveSuccess(ctx context.Context, successV interface{}) (*htt
// Receive creates a new HTTP request and returns the response. Success
// responses (2XX) are JSON decoded into the value pointed to by successV and
// other responses are JSON decoded into the value pointed to by failureV.
// If the status code of response is 204(no content) or the Content-Lenght is 0,
// If the status code of response is 204(no content) or the Content-Length is 0,
// decoding is skipped. Any error creating the request, sending it, or decoding
// the response is returned.
// Receive is shorthand for calling Request and Do.
Expand Down

0 comments on commit 9b8c476

Please sign in to comment.