-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
GO code staticcheck cleanup #1038
base: main
Are you sure you want to change the base?
Conversation
Ignored code generated files and fixed the left checks Signed-off-by: JUN JIE NAN <[email protected]>
"github.com/lxc/incus/v6/client" | ||
incus "github.com/lxc/incus/v6/client" |
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.
Looks like you ran goimports or something like that which has a tendency to go mess with our import names, can you remove all of those from your commit?
} else { //nolint:staticcheck // (keep the empty branch for the comment) | ||
//nolint:all | ||
//lint:ignore SA9003 keep the empty branch for the comment | ||
} else { //nolint:all |
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.
Not sure what's going on here, that change looks off.
@@ -28,6 +28,7 @@ func Reset(path string, imports []string, buildComment string, iface bool) error | |||
content := fmt.Sprintf(`%spackage %s | |||
|
|||
// The code below was generated by %s - DO NOT EDIT! | |||
//lint:file-ignore U1000,SA4006 Ignore staticcheck |
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.
So just because the files are auto-generated doesn't mean that issues/lints aren't worth fixing.
It just means that rather than fixing the issues directly in the .mapper.go
files, those issues need to instead be fixed in the generator code.
@@ -1,6 +1,8 @@ | |||
// Package response contains helpers for rendering HTTP responses. | |||
// | |||
//nolint:deadcode,unused | |||
//nolint:all |
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.
Why ignoring all lints?
@@ -332,6 +332,8 @@ func (c *Config) getConnectionArgs(name string) (*incus.ConnectionArgs, error) { | |||
// Golang has deprecated all methods relating to PEM encryption due to a vulnerability. | |||
// However, the weakness does not make PEM unsafe for our purposes as it pertains to password protection on the | |||
// key file (client.key is only readable to the user in any case), so we'll ignore deprecation. | |||
//nolint:all |
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.
Why turn off all linting?
@@ -366,6 +368,8 @@ func (c *Config) getConnectionArgs(name string) (*incus.ConnectionArgs, error) { | |||
return nil, fmt.Errorf("Unsupported key type: %T", sshKey) | |||
} | |||
} else { | |||
//nolint:all |
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.
Why turn off all linting?
@@ -241,7 +241,8 @@ func (c *cmdAdminRecover) Run(cmd *cobra.Command, args []string) error { | |||
// Send /internal/recover/import request to the daemon. | |||
// Don't lint next line with gosimple. It says we should convert reqValidate directly to an RecoverImportPost | |||
// because their types are identical. This is less clear and will not work if either type changes in the future. | |||
reqImport := recover.ImportPost{ //nolint:gosimple | |||
//nolint:all |
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.
Why turn off all linting?
@@ -593,6 +593,8 @@ func NotifyHeartbeat(state *state.State, gateway *Gateway) { | |||
// Wait for heartbeat to finish and then release. | |||
// Ignore staticcheck "SA2001: empty critical section" because we want to wait for the lock. | |||
gateway.HeartbeatLock.Lock() | |||
//nolint:all |
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.
Why turn off all linting?
@@ -593,6 +593,8 @@ func NotifyHeartbeat(state *state.State, gateway *Gateway) { | |||
// Wait for heartbeat to finish and then release. | |||
// Ignore staticcheck "SA2001: empty critical section" because we want to wait for the lock. | |||
gateway.HeartbeatLock.Lock() | |||
//nolint:all | |||
//lint:ignore SA2001 we want to wait for the lock |
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.
The comment above (// Ignore staticcheck ...
) can be removed given this one just repeats it
Ignored code generated files and fixed the left checks