-
Notifications
You must be signed in to change notification settings - Fork 213
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
Ignore/Fix all remaining staticcheck errors #2201
Ignore/Fix all remaining staticcheck errors #2201
Conversation
Signed-off-by: Tanmay Chaudhry <[email protected]>
pkg/config/loader.go
Outdated
@@ -48,7 +48,7 @@ func LoadFromViper(viperCfg func(v *viper.Viper)) DataStoreLoaderFunc { | |||
return func(ctx context.Context, cfg *Config, templateData map[string]interface{}) error { | |||
home, _ := cfg.GetHomeDir() | |||
|
|||
ctx, log := tracing.StartSpanWithName(ctx, "LoadFromViper", attribute.String("porter.PORTER_HOME", home)) | |||
_, log := tracing.StartSpanWithName(ctx, "LoadFromViper", attribute.String("porter.PORTER_HOME", home)) |
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.
I'd prefer to not change this here because setting the ctx variable is important. Even if ctx isn't used after this point, if we add a line in the future that uses ctx, with this change they will accidentally use the old ctx instead of the new scoped context.
I see more changes like this below and really all of those changes need to be reverted for the same reason.
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.
Makes sense. I'll revert it and add the //lint:ignore .
pkg/porter/lifecycle_test.go
Outdated
kahn1dot0Hash = "887e7e65e39277f8744bd00278760b06" | ||
kahn1dot01 = cnab.MustParseOCIReference("deislabs/kubekahn:1.0") | ||
//lint:ignore U1000 ignore unused variables | ||
kahn1dot0Hash = "887e7e65e39277f8744bd00278760b06" |
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.
These can be removed if they really aren't used. We have lots of tests elsewhere that vet the ParseOCIReference logic.
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.
Apparently one of these is used (but in a different file), the linter still complaints. To fix it, I have moved it to the file where it's used.
pkg/porter/parameters.go
Outdated
@@ -397,6 +397,7 @@ func (p *Porter) loadParameterSets(ctx context.Context, bun cnab.ExtendedBundle, | |||
return resolvedParameters, nil | |||
} | |||
|
|||
//lint:ignore U1000 Ignore unused function | |||
func (p *Porter) loadParameterFromFile(path string) (storage.ParameterSet, error) { |
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.
This functionality has been deprecated and can be removed.
@@ -15,12 +15,14 @@ import ( | |||
|
|||
var _ InstallationProvider = InstallationStore{} | |||
|
|||
//lint:ignore U1000 ignore unused warning | |||
var b64encode = func(src []byte) ([]byte, error) { |
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.
This functionality has been deprecated in the most recent version of the storage protocol and can be removed.
var b64encode = func(src []byte) ([]byte, error) { | ||
dst := make([]byte, base64.StdEncoding.EncodedLen(len(src))) | ||
base64.StdEncoding.Encode(dst, src) | ||
return dst, nil | ||
} | ||
|
||
//lint:ignore U1000 ignore unused warning | ||
var b64decode = func(src []byte) ([]byte, error) { |
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.
Same here, this can be removed.
tests/tester/helpers.go
Outdated
@@ -15,6 +15,7 @@ import ( | |||
"github.com/stretchr/testify/require" | |||
) | |||
|
|||
//lint:ignore U1000 ignore unused var | |||
var testBundleBuilt = false |
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.
This can be removed
Signed-off-by: Tanmay Chaudhry <[email protected]>
Made changes as requested. |
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.
Phew, it took a lot to clean up all the errors! Thank you for doing this. 💯
What does this change
This adds configuration to staticcheck to:
model.Options.SetBackground(true)
for mongo/options. This is deprecated and no longer needed. The default mechanism does not block anymore (https://www.mongodb.com/community/forums/t/after-4-2-background-createindexes/15136)What issue does it fix
Closes #2081
Notes for the reviewer
@carolynvs Please take a look at the
//lint:ignore
values. Maybe we can trim some of that already. Rest is self explanatory.Checklist
Reviewer Checklist