Skip to content

jsonnet-lint panics on an import that imports the same file #544

Open

Description

One of our files had an unused variable that was set to an import of the same file.

$ cat tmp/foo.libsonnet
local foo = import 'foo.libsonnet';
{}

$ jsonnet-lint tmp/foo.libsonnet
tmp/foo.libsonnet:1:7-35 Unused variable: foo

local foo = import 'foo.libsonnet';


panic: Bug - placeholder for a dependent node cannot be noType

goroutine 1 [running]:
github.com/google/go-jsonnet/linter/internal/types.(*typeGraph).getExprPlaceholder(...)
        /go/go-jsonnet/linter/internal/types/build_graph.go:26
github.com/google/go-jsonnet/linter/internal/types.calcTP(0x1200cc0, 0xc00010a100, 0xc00005f440, 0xc0001246c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /go/go-jsonnet/linter/internal/types/build_graph.go:217 +0x3696
github.com/google/go-jsonnet/linter/internal/types.prepareTPWithPlaceholder(0x1200cc0, 0xc00010a100, 0xc00005f440, 0xc0001246c0, 0x72)
        /go/go-jsonnet/linter/internal/types/build_graph.go:86 +0x179
github.com/google/go-jsonnet/linter/internal/types.prepareTPWithPlaceholder(0x1200fc0, 0xc000104280, 0xc00005f440, 0xc0001246c0, 0x71)
        /go/go-jsonnet/linter/internal/types/build_graph.go:62 +0xb2b
github.com/google/go-jsonnet/linter/internal/types.(*typeGraph).addRoots(0xc0001246c0, 0xc0001df698, 0xc0001df5d8)
        /go/go-jsonnet/linter/internal/types/build_graph.go:96 +0x3ee
github.com/google/go-jsonnet/linter/internal/types.Check(0x1200fc0, 0xc000104280, 0xc0001df698, 0xc0001df5d8, 0xc00004a7e0, 0xc0001df5c0)
        /go/go-jsonnet/linter/internal/types/check.go:139 +0xb4
github.com/google/go-jsonnet/linter.lint(0xc00005c0a0, 0x1200fc0, 0xc000104280, 0x7ffeefbff02d, 0x11, 0xc0001dfdb0)
        /go/go-jsonnet/linter/linter.go:76 +0x8a4
github.com/google/go-jsonnet/linter.LintSnippet(0xc00005c0a0, 0x11fd6c0, 0xc00000e020, 0x7ffeefbff02d, 0x11, 0xc00001c360, 0x27, 0xc000104140)
        /go/go-jsonnet/linter/linter.go:134 +0x13d
main.main()
        /go/go-jsonnet/cmd/jsonnet-lint/cmd.go:187 +0x84a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions