Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

pkg/analysis/importalias: Panic with anonymous import alias #9

Open
ldez opened this issue Feb 27, 2021 · 0 comments
Open

pkg/analysis/importalias: Panic with anonymous import alias #9

ldez opened this issue Feb 27, 2021 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@ldez
Copy link

ldez commented Feb 27, 2021

What steps did you take and what happened:

package a

import (
	_ "embed"
)
panic: runtime error: index out of range [-1]

goroutine 1838 [running]:
github.com/projectcontour/lint/pkg/analysis/importalias.getAliasFix(0xc0097dc8a0, 0x0, 0x0, 0xc0097dc8a0, 0x0)
        /home/ldez/sources/go/src/github.com/projectcontour/lint/pkg/analysis/importalias/analyzer.go:160 +0x1ca
github.com/projectcontour/lint/pkg/analysis/importalias.run.func1(0x73bde0, 0xc0097df950)
        /home/ldez/sources/go/src/github.com/projectcontour/lint/pkg/analysis/importalias/analyzer.go:96 +0x3f3
golang.org/x/tools/go/ast/inspector.(*Inspector).Preorder(0xc0097c0b70, 0xc000216b48, 0x1, 0x1, 0xc000216b38)
        /home/ldez/sources/go/pkg/mod/golang.org/x/[email protected]/go/ast/inspector/inspector.go:77 +0xa2
github.com/projectcontour/lint/pkg/analysis/importalias.run(0xc0097ad6c0, 0xc0097ad6c0, 0x0, 0x0, 0x0)
        /home/ldez/sources/go/src/github.com/projectcontour/lint/pkg/analysis/importalias/analyzer.go:41 +0xcd
golang.org/x/tools/go/analysis/internal/checker.(*action).execOnce(0xc0097648c0)
        /home/ldez/sources/go/pkg/mod/golang.org/x/[email protected]/go/analysis/internal/checker/checker.go:691 +0x85f
sync.(*Once).doSlow(0xc0097648c0, 0xc000176790)
        /home/ldez/.gvm/gos/go1.16/src/sync/once.go:68 +0xec
sync.(*Once).Do(...)
        /home/ldez/.gvm/gos/go1.16/src/sync/once.go:59
golang.org/x/tools/go/analysis/internal/checker.(*action).exec(0xc0097648c0)
        /home/ldez/sources/go/pkg/mod/golang.org/x/[email protected]/go/analysis/internal/checker/checker.go:579 +0x65
golang.org/x/tools/go/analysis/internal/checker.execAll.func1(0xc0097648c0)
        /home/ldez/sources/go/pkg/mod/golang.org/x/[email protected]/go/analysis/internal/checker/checker.go:567 +0x34
created by golang.org/x/tools/go/analysis/internal/checker.execAll
        /home/ldez/sources/go/pkg/mod/golang.org/x/[email protected]/go/analysis/internal/checker/checker.go:573 +0x125

What did you expect to happen:

Don't panic

@ldez ldez added the kind/bug Categorizes issue or PR as related to a bug. label Feb 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant