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

bug(parser): the parser is not working with different file types #6686

Closed
bigdatasourav opened this issue Aug 31, 2023 · 0 comments
Closed
Labels
bug Something isn't working community Community contribution terraform Terraform query

Comments

@bigdatasourav
Copy link

bigdatasourav commented Aug 31, 2023

Found a bug? You're welcome to GitHub Discussions
The parser available here is supposed to work with different file types, but it's throwing an error. Below are the details -

// parser
combinedParser, _ := parser.NewBuilder().
		Add(&json.Parser{}).
		Add(terraform.NewDefault()).
		Build([]string{""}, []string{""})

// file content
content, _ := os.ReadFile("/Users/testworld/test.json")

// get the parser data
for _,p := range combinedParser {
parsedDocs, err := p.Parse("/Users/testworld/test.json", content)
if err != nil{
fmt.Println(err).  // Here I am getting an error - Error: failed to parse file /Users/testworld/test.json: unsupported file to parse
}
}
  • Please make sure to:
    • Describe in details what the problem is
    • Attach a log file with relevant data preferably in DEBUG level (--log-level=DEBUG)
    • Attach the scanned sample files, anonymize the data if the original file cannot be provided
    • When attaching files to the issue make sure they are properly formatted

Expected Behavior

The parser should identify different file types and parse the file content accordingly. Please let me know if I need to use the parser differently.

Actual Behavior

Unable to parse different file types -

Error: failed to parse file /Users/testworld/test.json: unsupported file to parse

Steps to Reproduce the Problem

(Command line arguments and flags used)

  1. step 1
  2. step 2
  3. step 3

Specifications

(N/A if not applicable)

  • Version:
  • Platform:
  • Subsystem:
@bigdatasourav bigdatasourav added bug Something isn't working community Community contribution labels Aug 31, 2023
@github-actions github-actions bot added the terraform Terraform query label Aug 31, 2023
@bigdatasourav bigdatasourav changed the title bug: the parser is not working with different file types bug(parser): the parser is not working with different file types Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community Community contribution terraform Terraform query
Projects
None yet
Development

No branches or pull requests

1 participant