-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 golangci-lint
CI action, fix gosimple
, govet
+ unused
lint errors
#1127
Add golangci-lint
CI action, fix gosimple
, govet
+ unused
lint errors
#1127
Conversation
golangci-lint
, fix gosimple
, govet
+ unused
linter errorsgolangci-lint
CI action, fix gosimple
, govet
+ unused
lint errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ 🚀
EDIT: never mind, I don't have access to force-merge a PR with incomplete required jobs |
Done, mystery solved about where those jobs were configured - thanks! I've run the CI build now so you should be all good to merge once that's done 👍 |
@dm-2 👋 and thanks! |
…t errors (#1127) * Add `golangci-lint`, fix `gosimple`, `govet` and `unused` linter complaints * Go 1.16 * Update copyright dates
…t errors (#1127) * Add `golangci-lint`, fix `gosimple`, `govet` and `unused` linter complaints * Go 1.16 * Update copyright dates
Description
This PR adds a
golangci-lint
config and GitHub Action in order to lint thegh-ost
codeCurrently nothing is validating the cleanliness/best-practices of our Golang code
Initially only these linters are enabled:
gosimple
govet
unused
And I plan to create follow-up PRs to enable the remaining linters
Introducing these 3 x linters triggered these complaints that are resolved by this PR:
Linter errors raised/resolved:
func REDACTED is unused (unused)
S1025: should use String() instead of fmt.Sprintf (gosimple)
S1039: unnecessary use of fmt.Sprintf (gosimple)
S1019: should use make([]string, len(uniqueKeyColumnNames)) instead (gosimple)
S1023: redundant return statement (gosimple)
S1007: should use raw string (...) with regexp.MustCompile to avoid having to escape twice (gosimple)
go/mysql/instance_key.go
with//nolint:gosimple
because it's not a big dealS1011: should replace loop with env = append(env, extraVariables...) (gosimple)
S1038: should use fmt.Fprintf instead of fmt.Fprintln(fmt.Sprintf(...)) (but don't forget the newline) (gosimple)
composites: REDACTED composite literal uses unkeyed fields (govet)
unreachable: unreachable code (govet)
executeAndThrottleOnError
func fromgo/logic/migrator.go
script/cibuild
returns with no formatting errors, build errors or unit test errors.