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

Creating 2 verbs with the same name/signature causes panic #1186

Closed
wesbillman opened this issue Apr 5, 2024 · 0 comments · Fixed by #1205
Closed

Creating 2 verbs with the same name/signature causes panic #1186

wesbillman opened this issue Apr 5, 2024 · 0 comments · Fixed by #1205
Assignees
Labels
good first issue Good for newcomers

Comments

@wesbillman
Copy link
Collaborator

If time.go is updated to have duplicate verbs:

// Time returns the current time.
//
//ftl:export
func Time(ctx context.Context, req TimeRequest) (TimeResponse, error) {
	return TimeResponse{Time: time.Now()}, nil
}

// Time returns the current time.
//
//ftl:export
func Time(ctx context.Context, req TimeRequest) (TimeResponse, error) {
	return TimeResponse{Time: time.Now()}, nil
}

ftl dev . will panic:

info: Starting FTL with 1 controller(s)
info:time: Building module
panic: interface conversion: types.Object is nil, not *types.Func

goroutine 140 [running]:
github.com/TBD54566975/ftl/go-runtime/compile.visitFuncDecl(0x140003a6f00, 0x140004023f0)
	/Users/wesbillman/dev/ftl/go-runtime/compile/schema.go:473 +0x9b4
github.com/TBD54566975/ftl/go-runtime/compile.ExtractModuleSchema.func1({0x103df2550?, 0x140004023f0?}, 0x14000357ae0)
	/Users/wesbillman/dev/ftl/go-runtime/compile/schema.go:126 +0x1c8
github.com/TBD54566975/ftl/internal/goast.Visit(...)
	/Users/wesbillman/dev/ftl/internal/goast/visitor.go:17
github.com/TBD54566975/ftl/internal/goast.visitList[...]({0x14000ac6100?, 0x140004deec0?, 0x102b189a0?}, 0x140004deec0?)
	/Users/wesbillman/dev/ftl/internal/goast/visitor.go:558 +0xe4
github.com/TBD54566975/ftl/go-runtime/compile.ExtractModuleSchema.Visit.func2()
	/Users/wesbillman/dev/ftl/internal/goast/visitor.go:535 +0x2f8
github.com/TBD54566975/ftl/go-runtime/compile.ExtractModuleSchema.func1({0x103df25c8?, 0x1400001a000?}, 0x140001d2e08?)
	/Users/wesbillman/dev/ftl/go-runtime/compile/schema.go:145 +0x2b8
github.com/TBD54566975/ftl/internal/goast.Visit(...)
	/Users/wesbillman/dev/ftl/internal/goast/visitor.go:17
github.com/TBD54566975/ftl/go-runtime/compile.ExtractModuleSchema({0x1400031a990, 0x2a})
	/Users/wesbillman/dev/ftl/go-runtime/compile/schema.go:110 +0x66c
github.com/TBD54566975/ftl/go-runtime/compile.Build({0x103dfa1b8, 0x140004044e0}, {0x1400031a990, 0x2a}, 0x140003ea4c0)
	/Users/wesbillman/dev/ftl/go-runtime/compile/build.go:102 +0x338
github.com/TBD54566975/ftl/buildengine.buildGoModule({0x103dfa1b8?, 0x140004044e0?}, 0x104a4a430?, {{{0x1400031a990, 0x2a}, {0x140001a13c8, 0x2}, {0x140001a13cc, 0x4}, {0x140001a13d0, ...}, ...}, ...})
	/Users/wesbillman/dev/ftl/buildengine/build_go.go:12 +0x3c
github.com/TBD54566975/ftl/buildengine.buildModule({0x103dfa1f0, 0x140001a59a0}, 0x140003ea4c0, {{{0x1400031a990, 0x2a}, {0x140001a13c8, 0x2}, {0x140001a13cc, 0x4}, {0x140001a13d0, ...}, ...}, ...})
	/Users/wesbillman/dev/ftl/buildengine/build.go:34 +0x3c0
github.com/TBD54566975/ftl/buildengine.Build({0x103dfa1f0?, 0x140001a59a0?}, 0x14000346540?, {0x103dfa848?, 0x14000346540?})
	/Users/wesbillman/dev/ftl/buildengine/build.go:19 +0x94
github.com/TBD54566975/ftl/buildengine.(*Engine).build(0x1400021c080, {0x103dfa1f0, 0x140001a59a0}, {0x14000243200, 0x4}, 0x14000444c00, 0x14000151e60)
	/Users/wesbillman/dev/ftl/buildengine/engine.go:474 +0x29c
github.com/TBD54566975/ftl/buildengine.(*Engine).buildWithCallback.func1()
	/Users/wesbillman/dev/ftl/buildengine/engine.go:426 +0x94
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/Users/wesbillman/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x58
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 169
	/Users/wesbillman/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x98
[Error - 11:01:44 AM] The ftl languge server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 11:01:44 AM] Server process exited with code 2.
@wesbillman wesbillman added the good first issue Good for newcomers label Apr 5, 2024
@github-actions github-actions bot added the triage Issue needs triaging label Apr 5, 2024
@alecthomas alecthomas mentioned this issue Apr 5, 2024
@wesbillman wesbillman self-assigned this Apr 8, 2024
@github-actions github-actions bot removed the triage Issue needs triaging label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant