Skip to content

Commit

Permalink
Add more linters
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Sep 26, 2024
1 parent dc50006 commit 76796f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,33 @@ linters-settings:
ignore-generated-header: true
rules:
- name: blank-imports
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: defer
- name: dot-imports
- name: duplicated-imports
- name: empty-block
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: exported
- name: import-shadowing
- name: increment-decrement
- name: indent-error-flow
- name: package-comments
- name: range
- name: range-val-address
- name: range-val-in-closure
- name: receiver-naming
- name: redefines-builtin-id
- name: string-of-int
- name: superfluous-else
- name: time-naming
- name: unchecked-type-assertion
- name: unexported-return
- name: unnecessary-stmt
- name: unreachable-code
- name: unused-parameter
- name: var-declaration
Expand All @@ -37,6 +46,7 @@ linters:
- asasalint
- asciicheck
- bidichk
- containedctx
- contextcheck
- copyloopvar
- dupword
Expand All @@ -62,9 +72,11 @@ linters:
- intrange
- loggercheck
- makezero
- mirror
- misspell
- musttag
- nilerr
- nilnil
- noctx
- nolintlint
- paralleltest
Expand Down
6 changes: 3 additions & 3 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ func cloneRequest(req *http.Request) *http.Request {
func addMissingEnvironmentFlags(ka *kingpin.Application) {
for _, f := range ka.Model().FlagGroupModel.Flags {
if strings.HasPrefix(f.Name, "web.") && f.Envar == "" {
flag := ka.GetFlag(f.Name)
if flag != nil {
flag.Envar(convertFlagToEnvar(strings.TrimPrefix(f.Name, "web.")))
retrievedFlag := ka.GetFlag(f.Name)
if retrievedFlag != nil {
retrievedFlag.Envar(convertFlagToEnvar(strings.TrimPrefix(f.Name, "web.")))
}
}
}
Expand Down

0 comments on commit 76796f7

Please sign in to comment.