goadesign / goa

🌟 Goa: Elevate Go API development! 🚀 Streamlined design, automatic code generation, and seamless HTTP/gRPC support. ✨
https://goa.design
MIT License
5.63k stars 557 forks source link

SIGSEGV when generating design #3573

Closed njaremko closed 1 month ago

njaremko commented 1 month ago

I've attached the file here: design.go

exit status 2
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1005c1938]

goroutine 1 [running]:
goa.design/goa/v3/expr.DupScheme(...)
    /Users/njaremko/go/pkg/mod/goa.design/goa/v3@v3.18.2/expr/security.go:123
goa.design/goa/v3/dsl.Security({0x1400039fa90, 0x12?, 0x0?})
    /Users/njaremko/go/pkg/mod/goa.design/goa/v3@v3.18.2/dsl/security.go:255 +0x168
com/census/catalog/design.init.func1()
    /Users/njaremko/Development/delta/catalog/design/design.go:27 +0xe0
goa.design/goa/v3/eval.Execute(0x100c36c70?, {0x1008b4628?, 0x140001d8300?})
    /Users/njaremko/go/pkg/mod/goa.design/goa/v3@v3.18.2/eval/eval.go:78 +0x104
goa.design/goa/v3/eval.runSet({0x1400036edc0, 0x1, 0x1})
    /Users/njaremko/go/pkg/mod/goa.design/goa/v3@v3.18.2/eval/eval.go:196 +0x254
goa.design/goa/v3/expr.(*RootExpr).WalkSets(0x140001c6840, 0x1008b11c8)
    /Users/njaremko/go/pkg/mod/goa.design/goa/v3@v3.18.2/expr/root.go:61 +0x1bc
goa.design/goa/v3/eval.RunDSL()
    /Users/njaremko/go/pkg/mod/goa.design/goa/v3@v3.18.2/eval/eval.go:33 +0x3e0
main.main()
    /Users/njaremko/Development/delta/catalog/goa1222155152/main.go:55 +0x2d4
tchssk commented 1 month ago

OAuth2Security is a top level DSL. It must be assigned to a variable once and then pass it to the Security DSL.

var OAuth2 = OAuth2Security("oauth2")

var _ = API("api", func() {
    Security(OAuth2)
})
raphael commented 1 month ago

Thank you for the PR @tchssk !