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

Method WriteTo

hclwrite/ast.go:39–43  ·  view source on GitHub ↗

WriteTo writes the tokens underlying the receiving file to the given writer. The tokens first have a simple formatting pass applied that adjusts only the spaces between them.

(wr io.Writer)

Source from the content-addressed store, hash-verified

37// The tokens first have a simple formatting pass applied that adjusts only
38// the spaces between them.
39func (f *File) WriteTo(wr io.Writer) (int64, error) {
40 tokens := f.children.BuildTokens(nil)
41 format(tokens)
42 return tokens.WriteTo(wr)
43}
44
45// Bytes returns a buffer containing the source code resulting from the
46// tokens underlying the receiving file. If any updates have been made via

Callers 9

BytesMethod · 0.95
TestRoundTripVerbatimFunction · 0.45
FormatFunction · 0.45
TestTokensForValueFunction · 0.45
TestTokensForTraversalFunction · 0.45
TestTokensForTupleFunction · 0.45
TestTokensForObjectFunction · 0.45
FuzzParseConfigFunction · 0.45

Calls 2

formatFunction · 0.85
BuildTokensMethod · 0.65

Tested by 7

TestRoundTripVerbatimFunction · 0.36
TestTokensForValueFunction · 0.36
TestTokensForTraversalFunction · 0.36
TestTokensForTupleFunction · 0.36
TestTokensForObjectFunction · 0.36
FuzzParseConfigFunction · 0.36