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

Panic: file not found for pos when importing #226

Open
winterjung opened this issue Oct 14, 2024 · 5 comments
Open

Panic: file not found for pos when importing #226

winterjung opened this issue Oct 14, 2024 · 5 comments

Comments

@winterjung
Copy link

Thank you for creating this handy REPL! It works as expected for the most part, but I've encountered the panic issue. Could you please take a look and see if you can identify why this is happening?

Reproducible steps

  1. Attempt to use an unimported package function (e.g. gore> fmt.Print)
    a. Got an undefined error
  2. Try to import the package (e.g. gore> :import fmt
    a. A panic occurred
Detail Log
$ gore
gore version 0.5.7  :help for help
gore> fmt.Print("hi\n")
undefined: fmt
gore> :print
package main

import "github.com/k0kubun/pp/v3"

func __gore_p(xs ...any) {
    for _, x := range xs {
        pp.Println(x)
    }
}
func main() {}

gore> :import fmt
panic: file not found for pos = 71 (gore_session.go:6:21) [recovered]
	panic: file not found for pos = 71 (gore_session.go:6:21)

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0x14008d9b400, 0x140017838a8)
	/go/1.22.3/src/go/types/check.go:367 +0x9c
panic({0x1012d3740?, 0x140036a4970?})
	/go/1.22.3/src/runtime/panic.go:770 +0x124
go/types.(*Checker).fileFor(0x14008d9b400, 0x47)
	/go/1.22.3/src/go/types/version.go:131 +0x154
go/types.(*Checker).allowVersion(0x14008d9b400, 0x0?, {0x101338898?, 0x1400280ca60?}, {0x101222426, 0x6})
	/go/1.22.3/src/go/types/version.go:97 +0x64
go/types.(*Checker).verifyVersionf(0x14008d9b400, {0x101338898, 0x1400280ca60}, {0x101222426, 0x6}, {0x101232db9, 0xe}, {0x14001782ac0, 0x1, 0x1})
	/go/1.22.3/src/go/types/version.go:106 +0x6c
go/types.(*Checker).ident(0x14008d9b400, 0x1400751ecc0, 0x1400280ca60, 0x0, 0x1)
	/go/1.22.3/src/go/types/typexpr.go:46 +0x164
go/types.(*Checker).typInternal(0x14008d9b400, {0x10133a4d8, 0x1400280ca60}, 0x0)
	/go/1.22.3/src/go/types/typexpr.go:241 +0x4ec
go/types.(*Checker).definedType(0x14008d9b400, {0x10133a4d8, 0x1400280ca60}, 0x8?)
	/go/1.22.3/src/go/types/typexpr.go:180 +0x2c
go/types.(*Checker).varType(0x14008d9b400, {0x10133a4d8, 0x1400280ca60})
	/go/1.22.3/src/go/types/typexpr.go:145 +0x2c
go/types.(*Checker).collectParams(0x14008d9b400, 0x140057ff3e0, 0x140024de450, 0x1, 0x4b)
	/go/1.22.3/src/go/types/signature.go:291 +0x1e0
go/types.(*Checker).funcType(0x14008d9b400, 0x1400751ec80, 0x0, 0x1400280cb80)
	/go/1.22.3/src/go/types/signature.go:193 +0x31c
go/types.(*Checker).funcDecl(0x14008d9b400, 0x140057ff200, 0x140057ff260)
	/go/1.22.3/src/go/types/decl.go:836 +0xc8
go/types.(*Checker).objDecl(0x14008d9b400, {0x10133dcd8, 0x140057ff200}, 0x0)
	/go/1.22.3/src/go/types/decl.go:201 +0x78c
go/types.(*Checker).packageObjects(0x14008d9b400)
	/go/1.22.3/src/go/types/resolver.go:693 +0x468
go/types.(*Checker).checkFiles(0x14008d9b400, {0x140037ec250, 0x1, 0x1})
	/go/1.22.3/src/go/types/check.go:408 +0x164
go/types.(*Checker).Files(...)
	/go/1.22.3/src/go/types/check.go:372
go/types.(*Config).Check(0x14000466f60, {0x101221452?, 0x101220ee3?}, 0x14009e32840, {0x140037ec250, 0x1, 0x1}, 0x0)
	/go/1.22.3/src/go/types/api.go:458 +0x70
github.com/x-motemen/gore.actionImport(0x1400009b400, {0x1400216fea8, 0x3})
	/go/pkg/mod/github.com/x-motemen/[email protected]/commands.go:126 +0x2b8
github.com/x-motemen/gore.(*Session).invokeCommand(0x1400009b400, {0x1400216fea0?, 0x6?})
	/go/pkg/mod/github.com/x-motemen/[email protected]/session.go:459 +0x20c
github.com/x-motemen/gore.(*Session).Eval(0x1400009b400, {0x1400216fea0, 0xb})
	/go/pkg/mod/github.com/x-motemen/[email protected]/session.go:397 +0x124
github.com/x-motemen/gore.(*Gore).Run(0x1400008d7c0)
	/go/pkg/mod/github.com/x-motemen/[email protected]/gore.go:98 +0x4f0
github.com/x-motemen/gore/cli.(*cli).run(0x14000076440, {0x14000012190?, 0x101220678?, 0x0?})
	/go/pkg/mod/github.com/x-motemen/[email protected]/cli/cli.go:31 +0x78
github.com/x-motemen/gore/cli.Run(...)
	/go/pkg/mod/github.com/x-motemen/[email protected]/cli/run.go:10
main.main()
	/go/pkg/mod/github.com/x-motemen/[email protected]/cmd/gore/main.go:10 +0xc8

Environment

$ gore -version
gore 0.5.7 (rev: HEAD/go1.22.3)
$ go version
go version go1.22.3 darwin/arm64
$ uname
Darwin
$ arch
arm64
@winterjung winterjung changed the title Panic when importing Panic: file not found for pos when importing Oct 14, 2024
@itchyny
Copy link
Collaborator

itchyny commented Oct 14, 2024

Did you reinstall gore when upgrading Go?

@itchyny
Copy link
Collaborator

itchyny commented Oct 14, 2024

Oops, you seem to. Hmm.

@itchyny
Copy link
Collaborator

itchyny commented Oct 18, 2024

Okay, some of gore features stopped working since Go 1.22. Confirmed that the existing tests (TestAction_Type) fail with Go 1.22.

@itchyny
Copy link
Collaborator

itchyny commented Oct 18, 2024

Oh, this was already fixed in latest unreleased Go golang/go@9b1f8f3. Will be fixed in Go 1.24.

@winterjung
Copy link
Author

Awesome. Thanks for investigating! I'm looking forward to the Go 1.24 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants