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

jc.Error within select statement causes panic in japecheck #26

Open
ChrisSchinnerl opened this issue Jan 6, 2025 · 0 comments
Open

Comments

@ChrisSchinnerl
Copy link
Member

The following snippet when placed within the route's handler causes a panic in the jape check.

	select {
	case <-ctx.Done():
		jc.Error(errors.New("scan failed due to bus shutting down"), http.StatusServiceUnavailable)
		return
	default:
	}

Stacktrace:

panic: interface conversion: *ast.ExprStmt is not ast.Expr: missing method exprNode

goroutine 3290 [running]:
go.sia.tech/jape.checkSingleResponse.func4(0x14010c8d0e0, {0x0, 0x0})
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:439 +0x354
go.sia.tech/jape.checkSingleResponse.func4(0x14010c8d080, {0x0, 0x0})
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:497 +0x2f8
go.sia.tech/jape.checkSingleResponse.func4(0x14010c8cfc0, {0x0, 0x0})
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:441 +0x3dc
go.sia.tech/jape.checkSingleResponse.func4(0x14010c8cea0, {0x0, 0x0})
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:490 +0x5b4
go.sia.tech/jape.checkSingleResponse.func4(0x14010c8cd80, {0x0, 0x0})
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:490 +0x5b4
go.sia.tech/jape.checkSingleResponse.func4(0x14010c8cc60, {0x0, 0x0})
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:490 +0x5b4
go.sia.tech/jape.checkSingleResponse.func4(0x14010c8cba0, {0x0, 0x0})
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:442 +0x40c
go.sia.tech/jape.checkSingleResponse(0x1401e27a240, 0x1400d18b340)
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:525 +0x3dc
go.sia.tech/jape.run.func2({0x10267d810, 0x1401e2721c0})
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:715 +0x24c
go/ast.inspector.Visit(0x14010ca9320, {0x10267d810?, 0x1401e2721c0?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:361 +0x38
go/ast.Walk({0x10267be28?, 0x14010ca9320?}, {0x10267d810, 0x1401e2721c0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:34 +0x44
go/ast.walkList[...](...)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:21
go/ast.Walk({0x10267be28?, 0x14010ca9320?}, {0x10267d748, 0x1401e272200})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:121 +0x2214
go/ast.walkList[...](...)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:21
go/ast.Walk({0x10267be28?, 0x14010ca9320?}, {0x10267ddd8, 0x1401e279c40})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:203 +0x14bc
go/ast.walkList[...](...)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:21
go/ast.Walk({0x10267be28?, 0x14010ca9320?}, {0x10267d798, 0x1401e27ad50})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:211 +0x2a04
go/ast.Walk({0x10267be28?, 0x14010ca9320?}, {0x10267d7e8, 0x1401e27ad80})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:332 +0xd90
go/ast.walkList[...](...)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:21
go/ast.Walk({0x10267be28?, 0x14010ca9320?}, {0x10267d720, 0x140082560a0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:341 +0x2e24
go/ast.Inspect(...)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/ast/walk.go:372
go.sia.tech/jape.run(0x1400d18b340)
	/Users/cschinnerl/go/src/github.com/SiaFoundation/jape/analyzer.go:699 +0x528
golang.org/x/tools/go/analysis/internal/checker.(*action).execOnce(0x1401f48e3c0)
	/Users/cschinnerl/go/pkg/mod/golang.org/x/[email protected]/go/analysis/internal/checker/checker.go:759 +0x924
sync.(*Once).doSlow(0x52?, 0x1401eaac290?)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/sync/once.go:76 +0xf8
sync.(*Once).Do(...)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/sync/once.go:67
golang.org/x/tools/go/analysis/internal/checker.(*action).exec(...)
	/Users/cschinnerl/go/pkg/mod/golang.org/x/[email protected]/go/analysis/internal/checker/checker.go:666
golang.org/x/tools/go/analysis/internal/checker.execAll.func1(0x0?)
	/Users/cschinnerl/go/pkg/mod/golang.org/x/[email protected]/go/analysis/internal/checker/checker.go:654 +0x48
created by golang.org/x/tools/go/analysis/internal/checker.execAll in goroutine 1
	/Users/cschinnerl/go/pkg/mod/golang.org/x/[email protected]/go/analysis/internal/checker/checker.go:660 +0x148
@ChrisSchinnerl ChrisSchinnerl moved this to Todo in Sia Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant