MCPcopy
hub / github.com/hashicorp/hcl / ParseJSONFile

Method ParseJSONFile

hclparse/parser.go:101–109  ·  view source on GitHub ↗

ParseJSONFile reads the given filename and parses it as JSON, similarly to ParseJSON. An error diagnostic is returned if the given file cannot be read.

(filename string)

Source from the content-addressed store, hash-verified

99// ParseJSONFile reads the given filename and parses it as JSON, similarly to
100// ParseJSON. An error diagnostic is returned if the given file cannot be read.
101func (p *Parser) ParseJSONFile(filename string) (*hcl.File, hcl.Diagnostics) {
102 if existing := p.files[filename]; existing != nil {
103 return existing, nil
104 }
105
106 file, diags := json.ParseFile(filename)
107 p.files[filename] = file
108 return file, diags
109}
110
111// AddFile allows a caller to record in a parser a file that was parsed some
112// other way, thus allowing it to be included in the registry of sources.

Callers 2

parseVarsFileFunction · 0.80
realmainFunction · 0.80

Calls 1

ParseFileFunction · 0.92

Tested by

no test coverage detected