Skip to content
This repository was archived by the owner on Oct 25, 2020. It is now read-only.
This repository was archived by the owner on Oct 25, 2020. It is now read-only.

panic: didn't find any token of type TokenIdent #7

@jbmcfarlin31

Description

@jbmcfarlin31

On another repo I tried this tool on, it worked wonderfully! I decided to try it on another branch of one of my other repos and it failed with the following:

panic: didn't find any token of type TokenIdent

goroutine 1 [running]:
github.com/hashicorp/hcl/v2/hclwrite.inputTokens.PartitionType(0xc00010cba0, 0x0, 0x0, 0xc0001160f8, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:88 +0x580
github.com/hashicorp/hcl/v2/hclwrite.inputTokens.PartitionTypeSingle(0xc00010cba0, 0x0, 0x0, 0xc0001160f8, 0x0, 0x0, 0xc000000049, 0x0, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:92 +0xe3
github.com/hashicorp/hcl/v2/hclwrite.parseTraversalStep(0x709140, 0xc00009aaa0, 0xc00010cba0, 0x0, 0x0, 0xc0001160f8, 0x0, 0x0, 0xc00010cba0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:395 +0x364
github.com/hashicorp/hcl/v2/hclwrite.parseTraversal(0xc00000f0c0, 0x2, 0x2, 0xc00010cba0, 0x0, 0x0, 0xc0001160f8, 0x0, 0x0, 0xc00010cba0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:377 +0x3da
github.com/hashicorp/hcl/v2/hclwrite.parseExpression(0x70a780, 0xc0000a2160, 0xc00010cba0, 0x0, 0x0, 0xc0001160f8, 0x0, 0x0, 0x8)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:356 +0x175
github.com/hashicorp/hcl/v2/hclwrite.parseAttribute(0xc0000b47e0, 0xc00010cba0, 0x5, 0x5, 0xc0001160f8, 0x5, 0x5, 0xc00010ca80, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:260 +0xaf4
github.com/hashicorp/hcl/v2/hclwrite.parseBodyItem(0x707960, 0xc0000b47e0, 0xc00010ca80, 0x46, 0x46, 0xc0001160e0, 0x46, 0x46, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:217 +0x632
github.com/hashicorp/hcl/v2/hclwrite.parseBody(0xc0000a2370, 0xc00010ca80, 0x46, 0x46, 0xc0001160e0, 0x46, 0x46, 0x0, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:193 +0x68d
github.com/hashicorp/hcl/v2/hclwrite.parseBlock(0xc00009e240, 0xc00010ca80, 0x0, 0x0, 0xc0001160e0, 0x0, 0x0, 0xc00010c840, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:329 +0xf72
github.com/hashicorp/hcl/v2/hclwrite.parseBodyItem(0x7079a0, 0xc00009e240, 0xc00010c840, 0xd0, 0xd0, 0xc0001160b0, 0xd0, 0xd0, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:219 +0x4f7
github.com/hashicorp/hcl/v2/hclwrite.parseBody(0xc0000a2790, 0xc00010c360, 0xdd, 0xdd, 0xc000116048, 0xdd, 0xdd, 0x0, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:193 +0x68d
github.com/hashicorp/hcl/v2/hclwrite.parseBlock(0xc00009ea20, 0xc00010c360, 0x0, 0x0, 0xc000116048, 0x0, 0x0, 0xc00010c000, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:329 +0xf72
github.com/hashicorp/hcl/v2/hclwrite.parseBodyItem(0x7079a0, 0xc00009ea20, 0xc00010c000, 0xe8, 0xe8, 0xc000116000, 0xe8, 0xe8, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:219 +0x4f7
github.com/hashicorp/hcl/v2/hclwrite.parseBody(0xc0000a2840, 0xc00010c000, 0xe9, 0x100, 0xc000116000, 0xe9, 0xe9, 0x0, 0x0, 0x0, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:193 +0x68d
github.com/hashicorp/hcl/v2/hclwrite.parse(0xc0000f2000, 0x769, 0x969, 0xc0000201c0, 0x34, 0x1, 0x1, 0x0, 0xffffffffffffff9c, 0xc000020200, ...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/parser.go:53 +0x2e4
github.com/hashicorp/hcl/v2/hclwrite.ParseConfig(...)
        /root/odev/pkg/mod/github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0/hclwrite/public.go:27
main.processFile(0xc0000201c0, 0x34, 0x1a4)
        /tmp/terraform-clean-syntax/main.go:78 +0xc8
main.processItem(0xc0000201c0, 0x34)
        /tmp/terraform-clean-syntax/main.go:55 +0x2e7
main.processDir(0x7ffcdd7ba68a, 0x2d)
        /tmp/terraform-clean-syntax/main.go:67 +0x119
main.processItem(0x7ffcdd7ba68a, 0x2e)
        /tmp/terraform-clean-syntax/main.go:47 +0x1cc
main.main()
        /tmp/terraform-clean-syntax/main.go:30 +0xec

I re-cloned this repo, rebuilt the binary, and tried again but nothing changed, still the same error.
terraform-clean /my/dir/

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions