Skip to content

Commit

Permalink
Fix staticcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas11 committed May 31, 2024
1 parent 8ecfb6e commit 851e9c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions infer/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@ func (o Options) dispatch() dispatch.Options {
functions := map[tokens.Type]t.Invoke{}
for _, r := range o.Functions {
typ, err := r.GetToken()
contract.AssertNoError(err)
contract.AssertNoErrorf(err, "failed to get token for function %v", r)
functions[typ] = r
}
customs := map[tokens.Type]t.CustomResource{}
for _, r := range o.Resources {
typ, err := r.GetToken()
contract.AssertNoError(err)
contract.AssertNoErrorf(err, "failed to get token for resource %v", r)
customs[typ] = r
}
components := map[tokens.Type]t.ComponentResource{}
for _, r := range o.Components {
typ, err := r.GetToken()
contract.AssertNoError(err)
contract.AssertNoErrorf(err, "failed to get token for component %v", r)
components[typ] = r
}
return dispatch.Options{
Expand Down
4 changes: 2 additions & 2 deletions infer/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,11 +646,11 @@ func (g *fieldGenerator) ensureDefaultSecrets() {

args, ok, err := g.argsMatcher.TargetStructFields(g.args)
contract.Assertf(ok, "we match by construction")
contract.AssertNoError(err)
contract.AssertNoErrorf(err, "TargetStructFields on %v", g.args)

state, ok, err := g.stateMatcher.TargetStructFields(g.state)
contract.Assertf(ok, "we match by construction")
contract.AssertNoError(err)
contract.AssertNoErrorf(err, "TargetStructFields on %v", g.state)

for _, f := range state {
if f.Internal {
Expand Down
3 changes: 2 additions & 1 deletion infer/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,10 @@ func testHydrateFromState[O any](
return func(t *testing.T) {
t.Parallel()

type contextKey string
ctx := testContext{
//nolint:revive
Context: context.WithValue(context.Background(), "migrations", migrations),
Context: context.WithValue(context.Background(), contextKey("migrations"), migrations),
}

enc, actual, err := hydrateFromState[CustomHydrateFromState[O], struct{}, O](ctx, oldState)
Expand Down

0 comments on commit 851e9c1

Please sign in to comment.