From ba5477b790b32360d8e0a67f2425089e50057e7b Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Mon, 3 Aug 2026 19:50:49 -0400 Subject: [PATCH] refactor: drop ineffective omitempty on nested `OnlyExcept` fields `encoding/json` treats struct values as never empty, so `json:",omitempty"` on the embedded `OnlyExcept` field in `PostProcessor` and `Provisioner` has no effect. Removes the misleading tags; `OnlyExcept `already applies `omitempty` to its `Only` and `Except` slice fields, and JSON output is unchanged. Signed-off-by: Ryan Johnson --- template/template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/template.go b/template/template.go index 759751830..1a0260386 100644 --- a/template/template.go +++ b/template/template.go @@ -104,7 +104,7 @@ func (b *Builder) MarshalJSON() ([]byte, error) { // PostProcessor represents a post-processor within the template. type PostProcessor struct { - OnlyExcept `mapstructure:",squash" json:",omitempty"` + OnlyExcept `mapstructure:",squash"` Name string `json:"name,omitempty"` Type string `json:"type"` @@ -139,7 +139,7 @@ func (p *PostProcessor) MarshalJSON() ([]byte, error) { // Provisioner represents a provisioner within the template. type Provisioner struct { - OnlyExcept `mapstructure:",squash" json:",omitempty"` + OnlyExcept `mapstructure:",squash"` Type string `json:"type"` Config map[string]interface{} `json:"config,omitempty"`