Skip to content

Commit

Permalink
Merge pull request #28 from gcpug/fix-fallback-path
Browse files Browse the repository at this point in the history
Remove default case for unexpected types
  • Loading branch information
tenntenn committed Dec 10, 2019
2 parents 075ffe3 + fefd32a commit a99e587
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 17 additions & 0 deletions passes/wraperr/testdata/src/a/a.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,20 @@ func f9(ctx context.Context, client *spanner.Client) {
return lib.SpannerErr() // OK
})
}

func f10(ctx context.Context, client *spanner.Client) {
var outsideErr error
client.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error {
// Because err is a free variable,
// err may be assigned in other goroutines.
outsideErr = func(txn *spanner.ReadWriteTransaction) error {
stmt := spanner.Statement{SQL: `SELECT 1`}
_, err := client.Single().Query(ctx, stmt).Next()
if err != nil {
return &wrapErr{err}
}
return nil
}(txn) // OK
return outsideErr
})
}
2 changes: 0 additions & 2 deletions passes/wraperr/wraperr.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ func (r *runner) returnedWrappedErr(v ssa.Value) token.Pos {
if r.returnedWrappedErr(v.Common().Value) != token.NoPos {
return v.Pos()
}
default:
return v.Pos()
}
}
}
Expand Down

0 comments on commit a99e587

Please sign in to comment.