Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to golangci-lint meta-lint tool #272

Merged
merged 3 commits into from
Mar 29, 2022

Conversation

aramprice
Copy link
Member

@aramprice aramprice commented Mar 28, 2022

Currently bin/test-unit runs go run golang.org/x/lint/golint via bin/golint.

The golang.org/x/lint/golint command has been deprecated and frozen since 2020.

This commit switches to the meta-lint tool https://golangci-lint.run/

Additional Changes

  • Fixs https://github.com/koalaman/shellcheck/ issues with scripts in bin/
  • Removes dead code discovered by golangci-lint
  • Change formatter used by the project to goimports as recommended by golangci-lint
    • goimports adds import formatting and is otherwise the same as go fmt

- removed unused code in `jobsupervisor/`
- address shellcheck issues
- create generic `bin/lint` and `bin/format` helpers (not named after
  specific formatter / linter tools)
- add TODO's around making tests more modular
@aramprice aramprice changed the title Wip/switch to golangci lint Switch to golangci lint Mar 28, 2022
@aramprice aramprice changed the title Switch to golangci lint Switch to golangci-lint meta-lint tool Mar 28, 2022
}
}
return hints
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume pruneNil is not called anywhere. Nice job cleaning up!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, quite a bit of dead code. Mostly stuff that was replaced by sigar but never removed.

@cunnie cunnie self-requested a review March 29, 2022 20:07
@@ -275,7 +275,7 @@ var _ = Describe("cascadingBlobstore", func() {
blobManagers = append(blobManagers, blobManager)
}

index := rand.Intn(10)
index := rand.Intn(10) //nolint:gosec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why generating a random number could provoke a security problem?

@@ -60,7 +60,3 @@ func (r *StartManager) persistentBootoncePath() string {
func (r *StartManager) tmpfsBootoncePath() string {
return filepath.Join(r.dirProvider.CanRestartDir(), BootonceFileName)
}

func touch(fs boshsys.FileSystem, path string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function never used?

@camilalonart camilalonart merged commit 7ac3fc8 into main Mar 29, 2022
@aramprice aramprice deleted the wip/switch-to-golangci-lint branch March 29, 2022 22:48
Justin-W added a commit to calculi-corp/bosh-agent that referenced this pull request Mar 31, 2022
…vior.

This fixes an inconsistency between output vs behavior that was introduced by edfed12 as part of cloudfoundry#272.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants