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

Add staticcheck #41

Open
Noxsios opened this issue Mar 26, 2024 · 1 comment
Open

Add staticcheck #41

Noxsios opened this issue Mar 26, 2024 · 1 comment
Labels
good first issue Good for newcomers

Comments

@Noxsios
Copy link
Contributor

Noxsios commented Mar 26, 2024

Is your feature request related to a problem? Please describe.

https://staticcheck.dev/

Currently there are niceities that go vet and revive do not have that staticcheck provides, primarily finding and reporting on Deprecated features.

Describe the solution you'd like

  • Given a function/feature has been deprecated
  • When CI is run
  • Then staticcheck fails on deprecated usages of that feature

Example:

// First30Last30 returns the source string that has been trimmed to 30 characters at the beginning and end.
func First30Last30(s string) string {
	if len(s) > 60 {
		return s[0:27] + "..." + s[len(s)-26:]
	}

	return s
}

// First30last30 returns the source string that has been trimmed to 30 characters at the beginning and end.
//
// Deprecated: Use First30Last30 instead.
func First30last30(s string) string {
	return First30Last30(s)
}

First30last30 should be named First30Last30. In VSCode with the Go extension, staticcheck properly reports the deprecated usage.

Screenshot 2024-03-26 at 12 01 24 PM

❯ staticcheck
main.go:12:12: helpers.First30last30 is deprecated: Use First30Last30 instead.  (SA1019)
@Noxsios Noxsios moved this to Ready in Zarf (old) Mar 26, 2024
@Noxsios Noxsios moved this from Ready to Backlog in Zarf (old) Mar 26, 2024
@Noxsios
Copy link
Contributor Author

Noxsios commented May 23, 2024

This should actually be to add golangci-lint, similar to what exists now on Zarf.

@Noxsios Noxsios added the good first issue Good for newcomers label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
No open projects
Status: Backlog
Development

No branches or pull requests

1 participant