(ui packersdk.Ui, files map[string]*hcl.File, diags hcl.Diagnostics)
| 68 | } |
| 69 | |
| 70 | func 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 | |
| 88 | func (c *BuildCommand) RunContext(buildCtx context.Context, cla *BuildArgs) int { |
| 89 | // Set the release only flag if specified as argument |
no test coverage detected
searching dependent graphs…