MCPcopy
hub / github.com/hashicorp/packer / writeDiags

Function writeDiags

command/build.go:70–86  ·  view source on GitHub ↗
(ui packersdk.Ui, files map[string]*hcl.File, diags hcl.Diagnostics)

Source from the content-addressed store, hash-verified

68}
69
70func writeDiags(ui packersdk.Ui, files map[string]*hcl.File, diags hcl.Diagnostics) int {
71 // write HCL errors/diagnostics if any.
72 b := bytes.NewBuffer(nil)
73 err := hcl.NewDiagnosticTextWriter(b, files, 80, false).WriteDiagnostics(diags)
74 if err != nil {
75 ui.Error("could not write diagnostic: " + err.Error())
76 return 1
77 }
78 if b.Len() != 0 {
79 if diags.HasErrors() {
80 ui.Error(b.String())
81 return 1
82 }
83 ui.Say(b.String())
84 }
85 return 0
86}
87
88func (c *BuildCommand) RunContext(buildCtx context.Context, cla *BuildArgs) int {
89 // Set the release only flag if specified as argument

Callers 10

modePipedMethod · 0.85
modeInteractiveMethod · 0.85
RunContextMethod · 0.85
RunContextMethod · 0.85
RunContextMethod · 0.85
InstallFromBinaryMethod · 0.85
RunContextMethod · 0.85
GetConfigFromHCLMethod · 0.85
RunContextMethod · 0.85
RunContextMethod · 0.85

Calls 4

ErrorMethod · 0.65
StringMethod · 0.65
LenMethod · 0.45
SayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…