cogentcore / core

A free and open source framework for building powerful, fast, elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the web with a single Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.76k stars 83 forks source link

core generate crash #1095

Open rcoreilly opened 3 months ago

rcoreilly commented 3 months ago

Describe the bug

run go generate on 7efd3684b in gpu/phong -- it crashes

How to reproduce

run go generate on 7efd3684b in gpu/phong -- it crashes

Example code

No response

Relevant output

cd /Users/oreilly/go/src/cogentcore.org/core/gpu/phong (from: {FileDirPath})
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x50 pc=0x1050257ec]

goroutine 1 [running]:
cogentcore.org/core/types/typegen.(*Generator).InspectGenDecl(0x140001f2380, 0x140014a1f00)
    /Users/oreilly/go/src/cogentcore.org/core/types/typegen/generator.go:147 +0x19c
cogentcore.org/core/types/typegen.(*Generator).Inspect(0x14000387980?, {0x1057b6648?, 0x140014a1f00?})
    /Users/oreilly/go/src/cogentcore.org/core/types/typegen/generator.go:127 +0xe8
cogentcore.org/core/base/generate.Inspect.func1({0x1057b6648, 0x140014a1f00})
    /Users/oreilly/go/src/cogentcore.org/core/base/generate/generate.go:75 +0x4c
go/ast.inspector.Visit(0x140081f9c80, {0x1057b6648?, 0x140014a1f00?})
    /opt/homebrew/Cellar/go/1.22.5/libexec/src/go/ast/walk.go:386 +0x38
go/ast.Walk({0x1057b3dc0?, 0x140081f9c80?}, {0x1057b6648, 0x140014a1f00})
    /opt/homebrew/Cellar/go/1.22.5/libexec/src/go/ast/walk.go:51 +0x44
go/ast.walkDeclList(...)
    /opt/homebrew/Cellar/go/1.22.5/libexec/src/go/ast/walk.go:38
go/ast.Walk({0x1057b3dc0?, 0x140081f9c80?}, {0x1057b6698, 0x14000a2afa0})
    /opt/homebrew/Cellar/go/1.22.5/libexec/src/go/ast/walk.go:366 +0x2e14
go/ast.Inspect(...)
    /opt/homebrew/Cellar/go/1.22.5/libexec/src/go/ast/walk.go:397
cogentcore.org/core/base/generate.Inspect(0x140001f2380?, 0x1400341cf90)
    /Users/oreilly/go/src/cogentcore.org/core/base/generate/generate.go:71 +0x10c
cogentcore.org/core/types/typegen.(*Generator).Find(0x140001f2380)
    /Users/oreilly/go/src/cogentcore.org/core/types/typegen/generator.go:83 +0x9c
cogentcore.org/core/types/typegen.GeneratePkgs(0x14000193d70, {0x14007c295f8, 0x1, 0x1})
    /Users/oreilly/go/src/cogentcore.org/core/types/typegen/typegen.go:63 +0xe8
cogentcore.org/core/cmd/core/generate.Generate(0x14000193b88)
    /Users/oreilly/go/src/cogentcore.org/core/cmd/core/generate/generate.go:111 +0x378
cogentcore.org/core/cli.runCmd[...](0x140002c38f0, 0x14000193b88, {0x16b12f855, 0x8}, {0x140002e7800, 0xb, 0xb})
    /Users/oreilly/go/src/cogentcore.org/core/cli/cli.go:72 +0xc8
cogentcore.org/core/cli.Run[...](0x140002c38f0, 0x14000193b88, {0x1400004bed0, 0x140000021c0?, 0x14000054508?})
    /Users/oreilly/go/src/cogentcore.org/core/cli/cli.go:51 +0x1c0
main.main()
    /Users/oreilly/go/src/cogentcore.org/core/cmd/core/core.go:20 +0x178
phong.go:7: running "core": exit status 2

Platform

macOS

kkoreilly commented 6 days ago

Is this still an issue?

rcoreilly commented 6 days ago

If you didn't fix it, it undoubtedly will still crash. I don't think it is a common situation that causes it however.