Skip to content

Commit

Permalink
Fix lint errors for latest golangci-lint
Browse files Browse the repository at this point in the history
They deprecated check-shadowing. This config approximates the
previous config.
  • Loading branch information
lkysow committed Mar 25, 2024
1 parent 453869d commit 5000436
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ issues:
# Disable the default exclude list so that all excludes are explicitly
# defined in this file.
exclude-use-default: false

exclude-rules:
- text: 'shadow: declaration of "(err|ctx)" shadows declaration at'
linters: [ govet ]

linters-settings:
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
- nilness
- shadow
- unusedwrite
forbidigo:
# Forbid the following identifiers (list of regexp).
Expand Down
4 changes: 2 additions & 2 deletions child/command-prep.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func CommandPrep(command []string) ([]string, bool, error) {
if _, err := exec.LookPath(shell); err != nil {
shell = ""
for _, sh := range []string{"/bin/sh", "/usr/bin/sh"} {
if sh, err := exec.LookPath(sh); err == nil {
shell = sh
if absPath, err := exec.LookPath(sh); err == nil {
shell = absPath
break
}
}
Expand Down
6 changes: 3 additions & 3 deletions config/nomad_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ func TestNomadConfig_Finalize(t *testing.T) {
// This test is envvar sensitive, so there are a whole lot of them that need
// to be backed up and reset after the test
nomadVars := make(map[string]string)
for _, v := range os.Environ() {
if strings.HasPrefix(v, "NOMAD_") {
k, v, found := strings.Cut(v, "=")
for _, envVar := range os.Environ() {
if strings.HasPrefix(envVar, "NOMAD_") {
k, v, found := strings.Cut(envVar, "=")
if found {
nomadVars[k] = v
os.Unsetenv(k)
Expand Down
4 changes: 2 additions & 2 deletions manager/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,9 @@ func (r *Runner) runTemplate(tmpl *template.Template, runCtx *templateRunCtx) (*
// in once mode, and we certainly do not want to re-run any commands.
if r.config.Once {
r.renderEventsLock.RLock()
event, ok := r.renderEvents[tmpl.ID()]
onceEvent, ok := r.renderEvents[tmpl.ID()]
r.renderEventsLock.RUnlock()
if ok && (event.WouldRender || event.DidRender) {
if ok && (onceEvent.WouldRender || onceEvent.DidRender) {
log.Printf("[DEBUG] (runner) once mode and already rendered")
return nil, nil
}
Expand Down

0 comments on commit 5000436

Please sign in to comment.