Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
Christian Mesh
2025-12-18 07:57:12 -05:00
parent 272a0a8327
commit 343c88b036
4 changed files with 13 additions and 13 deletions

View File

@@ -234,8 +234,8 @@ func (v *OutputJSON) Output(name string, outputs map[string]*states.OutputValue)
return diags return diags
} }
v.output.Write(jsonOutput) _, _ = v.output.Write(jsonOutput)
v.output.Write([]byte("\n")) _, _ = v.output.Write([]byte("\n"))
return nil return nil
} }
@@ -279,8 +279,8 @@ func (v *OutputJSON) Output(name string, outputs map[string]*states.OutputValue)
return diags return diags
} }
v.output.Write(jsonOutputs) _, _ = v.output.Write(jsonOutputs)
v.output.Write([]byte("\n")) _, _ = v.output.Write([]byte("\n"))
return nil return nil
} }

View File

@@ -237,7 +237,7 @@ func (v *ShowJSON) DisplayState(_ context.Context, stateFile *statefile.File, sc
v.view.streams.Eprintf("Failed to marshal state to json: %s", err) v.view.streams.Eprintf("Failed to marshal state to json: %s", err)
return 1 return 1
} }
v.output.Write(jsonState) _, _ = v.output.Write(jsonState)
return 0 return 0
} }
@@ -249,7 +249,7 @@ func (v *ShowJSON) DisplayPlan(_ context.Context, plan *plans.Plan, planJSON *cl
v.view.streams.Eprintf("Didn't get external JSON plan format") v.view.streams.Eprintf("Didn't get external JSON plan format")
return 1 return 1
} }
v.output.Write(planJSON.JSONBytes) _, _ = v.output.Write(planJSON.JSONBytes)
} else if plan != nil { } else if plan != nil {
planJSON, err := jsonplan.Marshal(config, plan, priorStateFile, schemas) planJSON, err := jsonplan.Marshal(config, plan, priorStateFile, schemas)
@@ -257,12 +257,12 @@ func (v *ShowJSON) DisplayPlan(_ context.Context, plan *plans.Plan, planJSON *cl
v.view.streams.Eprintf("Failed to marshal plan to json: %s", err) v.view.streams.Eprintf("Failed to marshal plan to json: %s", err)
return 1 return 1
} }
v.output.Write(planJSON) _, _ = v.output.Write(planJSON)
} else { } else {
// Should not get here because at least one of the two plan arguments // Should not get here because at least one of the two plan arguments
// should be present, but we'll tolerate this by just returning an // should be present, but we'll tolerate this by just returning an
// empty JSON object. // empty JSON object.
v.output.Write([]byte("{}")) _, _ = v.output.Write([]byte("{}"))
} }
return 0 return 0
} }
@@ -273,7 +273,7 @@ func (v *ShowJSON) DisplayConfig(config *configs.Config, schemas *tofu.Schemas)
v.view.streams.Eprintf("Failed to marshal configuration to JSON: %s", err) v.view.streams.Eprintf("Failed to marshal configuration to JSON: %s", err)
return 1 return 1
} }
v.output.Write(configJSON) _, _ = v.output.Write(configJSON)
return 0 return 0
} }
@@ -283,7 +283,7 @@ func (v *ShowJSON) DisplaySingleModule(module *configs.Module) int {
v.view.streams.Eprintf("Failed to marshal module contents to JSON: %s", err) v.view.streams.Eprintf("Failed to marshal module contents to JSON: %s", err)
return 1 return 1
} }
v.output.Write(moduleJSON) _, _ = v.output.Write(moduleJSON)
return 0 return 0
} }

View File

@@ -92,7 +92,7 @@ func (v *StateLockerJSON) Locking() {
lock_info_message, _ := json.Marshal(json_data) lock_info_message, _ := json.Marshal(json_data)
lock_info_message = append(lock_info_message, '\n') lock_info_message = append(lock_info_message, '\n')
v.output.Write(lock_info_message) _, _ = v.output.Write(lock_info_message)
} }
func (v *StateLockerJSON) Unlocking() { func (v *StateLockerJSON) Unlocking() {
@@ -107,5 +107,5 @@ func (v *StateLockerJSON) Unlocking() {
lock_info_message, _ := json.Marshal(json_data) lock_info_message, _ := json.Marshal(json_data)
lock_info_message = append(lock_info_message, '\n') lock_info_message = append(lock_info_message, '\n')
v.output.Write(lock_info_message) _, _ = v.output.Write(lock_info_message)
} }

View File

@@ -157,7 +157,7 @@ func (v *ValidateJSON) Results(diags tfdiags.Diagnostics) int {
// Should never happen because we fully-control the input here // Should never happen because we fully-control the input here
panic(err) panic(err)
} }
v.output.Write(j) _, _ = v.output.Write(j)
if diags.HasErrors() { if diags.HasErrors() {
return 1 return 1