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: unreachable #41

Open
Hades32 opened this issue Jun 23, 2022 · 3 comments
Open

Panic: unreachable #41

Hades32 opened this issue Jun 23, 2022 · 3 comments

Comments

@Hades32
Copy link

Hades32 commented Jun 23, 2022

I get a panic when trying to format my code:

# h32 @ DESKTOP-J1Q9JRK in ~/mysvc on git:main o [10:37:15] C:1
$ go install github.com/cockroachdb/crlfmt@latest
go: downloading github.com/cockroachdb/crlfmt v0.0.0-20220610162206-024b567ce87b
go: downloading github.com/cockroachdb/gostdlib v1.13.0
go: downloading github.com/cockroachdb/ttycolor v0.0.0-20180709150743-a1d5aaeb377d
go: downloading golang.org/x/tools v0.0.0-20200923014426-f5e916c686e1

# h32 @ DESKTOP-J1Q9JRK in ~/mysvc on git:main o [10:38:08] C:130
$ crlfmt .
panic: unreachable

goroutine 1 [running]:
github.com/cockroachdb/gostdlib/go/printer.(*printer).expr1(0xc0003d5cf8, {0x71a318, 0xc0003c2180}, 0x7, 0x1)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:967 +0x1bfd
github.com/cockroachdb/gostdlib/go/printer.(*printer).possibleSelectorExpr(0xc0003d5cf8?, {0x71a318?, 0xc0003c2180?}, 0x40c8c9?, 0xc0003c1560?)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:975 +0x49
github.com/cockroachdb/gostdlib/go/printer.(*printer).expr1(0xc0003d5cf8, {0x719f28, 0xc0003c21c0}, 0x0, 0x1)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:883 +0x1445
github.com/cockroachdb/gostdlib/go/printer.(*printer).expr(...)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1001
github.com/cockroachdb/gostdlib/go/printer.(*printer).printNode(0xc0003d5cf8, {0x670080?, 0xc0003c21c0?})
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/printer.go:1128 +0x331
github.com/cockroachdb/gostdlib/go/printer.(*Config).fprint(0xc0003d5ea8, {0x7181c8?, 0xc0003c6d50}, 0x40982d?, {0x670080, 0xc0003c21c0}, 0xc0003c6a50)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/printer.go:1293 +0x17c
github.com/cockroachdb/gostdlib/go/printer.(*printer).nodeSize(0xc0003d6620, {0x719118?, 0xc0003c21c0}, 0xf4240)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1599 +0x134
github.com/cockroachdb/gostdlib/go/printer.(*printer).exprList(0xc0003d6620, 0xc0003d63b8?, {0xc0003c2300, 0x3, 0x66?}, 0x20?, 0x1, 0x12?, 0x0)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:212 +0x8c5
github.com/cockroachdb/gostdlib/go/printer.(*printer).expr1(0xc0003d6620, {0x719f28, 0xc0003c2340}, 0x0, 0x1)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:893 +0x17b1
github.com/cockroachdb/gostdlib/go/printer.(*printer).expr(...)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1001
github.com/cockroachdb/gostdlib/go/printer.(*printer).printNode(0xc0003d6620, {0x670080?, 0xc0003c2340?})
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/printer.go:1128 +0x331
github.com/cockroachdb/gostdlib/go/printer.(*Config).fprint(0xc0003d67d0, {0x7181c8?, 0xc0003c6d20}, 0x40982d?, {0x670080, 0xc0003c2340}, 0xc0003c6a50)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/printer.go:1293 +0x17c
github.com/cockroachdb/gostdlib/go/printer.(*printer).nodeSize(0xc0003d73c0, {0x719118?, 0xc0003c2340}, 0xf4240)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1599 +0x134
github.com/cockroachdb/gostdlib/go/printer.(*printer).exprList(0xc0003d73c0, 0xc0003d6da8?, {0xc0003aa820, 0x1, 0x4cfe83?}, 0xc00036ec60?, 0x0, 0x1?, 0x0)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:212 +0x8c5
github.com/cockroachdb/gostdlib/go/printer.(*printer).stmt(0xc0003d73c0, {0x719da8, 0xc0003c2380}, 0x0)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1219 +0x137b
github.com/cockroachdb/gostdlib/go/printer.(*printer).stmtList(0xc0003d73c0, {0xc0003c24c0, 0x4, 0x13?}, 0x1, 0x1)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1027 +0x2bf
github.com/cockroachdb/gostdlib/go/printer.(*printer).block(0xc0003d73c0, 0xc0003a9b60, 0x1?)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1050 +0xc5
github.com/cockroachdb/gostdlib/go/printer.(*printer).funcBody(0xc0003d73c0, 0x8e, 0xb, 0xc0003a9b60)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1687 +0x268
github.com/cockroachdb/gostdlib/go/printer.(*printer).funcDecl(0x52bbcb?, 0xc0003a9b90)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1711 +0x17d
github.com/cockroachdb/gostdlib/go/printer.(*printer).decl(0xc0003d73c0?, {0x71a138?, 0xc0003a9b90?})
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1721 +0x51
github.com/cockroachdb/gostdlib/go/printer.(*printer).declList(0xc0003d73c0, {0xc0003ae400?, 0x9, 0x0?})
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1764 +0x449
github.com/cockroachdb/gostdlib/go/printer.(*printer).file(0xc0003d73c0?, 0xc00033dc00)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/nodes.go:1772 +0xf3
github.com/cockroachdb/gostdlib/go/printer.(*printer).printNode(0xc0003d73c0, {0x66c480?, 0xc00033dc00?})
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/printer.go:1152 +0x477
github.com/cockroachdb/gostdlib/go/printer.(*Config).fprint(0xc0003d75d0, {0x7181c8?, 0xc0003c6a20}, 0x0?, {0x66c480, 0xc00033dc00}, 0xc0003c6a50)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/printer.go:1293 +0x17c
github.com/cockroachdb/gostdlib/go/printer.(*Config).Fprint(...)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/go/printer/printer.go:1351
github.com/cockroachdb/gostdlib/x/tools/internal/imports.formatFile(0xc0000cd980?, 0xc0000cd980?, {0xc0003be000, 0x95f, 0x960}, 0x0, 0xc0003d7718)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/x/tools/internal/imports/imports.go:177 +0x17c
github.com/cockroachdb/gostdlib/x/tools/internal/imports.Process({0xc0000cd980, 0x12}, {0xc0003be000?, 0x10000000000000b?, 0x15e?}, 0x5f3?)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/x/tools/internal/imports/imports.go:63 +0x113
github.com/cockroachdb/gostdlib/x/tools/imports.Process({0xc0000cd980, 0x12}, {0xc0003be000, 0x95f, 0x960}, 0x64?)
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/x/tools/imports/forward.go:55 +0x185
main.checkBuf({0xc0000cd980, 0x12}, {0xc0003be000?, 0xc0000021a0?, 0x43c325?})
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/main.go:172 +0x1df
main.checkPath({0xc0000cd980, 0x12})
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/main.go:125 +0x79
main.run.func1({0xc0000cd980, 0x12}, {0x71afe8?, 0xc0003b8820?}, {0x0?, 0x0?})
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/main.go:111 +0x10a
path/filepath.walk({0xc0000cd980, 0x12}, {0x71afe8, 0xc0003b8820}, 0xc000391ef8)
        /home/h32/.gvm/gos/go1.18.2/src/path/filepath/path.go:418 +0x123
path/filepath.walk({0xc0003ac9c7, 0x9}, {0x71afe8, 0xc0003b8750}, 0xc0003d7ef8)
        /home/h32/.gvm/gos/go1.18.2/src/path/filepath/path.go:442 +0x285
path/filepath.walk({0x6a21a0, 0x1}, {0x71afe8, 0xc0000a3c70}, 0xc0003d7ef8)
        /home/h32/.gvm/gos/go1.18.2/src/path/filepath/path.go:442 +0x285
path/filepath.Walk({0x6a21a0, 0x1}, 0xc000093ef8)
        /home/h32/.gvm/gos/go1.18.2/src/path/filepath/path.go:505 +0x6c
main.run()
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/main.go:98 +0x17f
main.main()
        /home/h32/.gvm/pkgsets/go1.18.2/global/pkg/mod/github.com/cockroachdb/[email protected]/main.go:56 +0x19
@knz
Copy link
Contributor

knz commented Jun 23, 2022

crlfmt depends on a copy of some components from the go stdlib (in the repository cockroachdb/gostdlib) which are from go 1.13,
and these have changed in go 1.18 enough that they are not any more compatible.

we need to update our copy of the internal components to 1.18 too.
In the meantime perhaps you can try building crlfmt using go 1.17 or earlier.

@Hades32
Copy link
Author

Hades32 commented Jun 23, 2022

Thanks @knz, I think I'll just wait then.

Would you mind sharing why you had to fork the stdlib? That's pretty wild :D

@knz
Copy link
Contributor

knz commented Jun 23, 2022

We did not fork all of it. Only some internal components used to prtty-print the AST of the code (to reformat it).

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