Skip to content
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

Remove default case for unexpected types #28

Merged
merged 1 commit into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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