diff --git a/pkg/action/install.go b/pkg/action/install.go index d05aae505..5f159c382 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -628,7 +628,7 @@ func writeToFile(outputDir string, name string, data string, appendData bool) er defer f.Close() - _, err = f.WriteString(fmt.Sprintf("---\n# Source: %s\n%s\n", name, data)) + _, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, data) if err != nil { return err diff --git a/pkg/cmd/template.go b/pkg/cmd/template.go index 25ff31ade..f96b25e30 100644 --- a/pkg/cmd/template.go +++ b/pkg/cmd/template.go @@ -230,7 +230,7 @@ func writeToFile(outputDir string, name string, data string, appendData bool) er defer f.Close() - _, err = f.WriteString(fmt.Sprintf("---\n# Source: %s\n%s\n", name, data)) + _, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, data) if err != nil { return err diff --git a/pkg/registry/utils_test.go b/pkg/registry/utils_test.go index 8e6943222..fe07c769a 100644 --- a/pkg/registry/utils_test.go +++ b/pkg/registry/utils_test.go @@ -184,9 +184,7 @@ func initCompromisedRegistryTestServer() string { w.Header().Set("Content-Type", "application/vnd.oci.image.manifest.v1+json") w.WriteHeader(200) - // layers[0] is the blob []byte("a") - w.Write([]byte( - fmt.Sprintf(`{ "schemaVersion": 2, "config": { + fmt.Fprintf(w, `{ "schemaVersion": 2, "config": { "mediaType": "%s", "digest": "sha256:a705ee2789ab50a5ba20930f246dbd5cc01ff9712825bb98f57ee8414377f133", "size": 181 @@ -198,7 +196,7 @@ func initCompromisedRegistryTestServer() string { "size": 1 } ] -}`, ConfigMediaType, ChartLayerMediaType))) +}`, ConfigMediaType, ChartLayerMediaType) } else if r.URL.Path == "/v2/testrepo/supposedlysafechart/blobs/sha256:a705ee2789ab50a5ba20930f246dbd5cc01ff9712825bb98f57ee8414377f133" { w.Header().Set("Content-Type", "application/json") w.WriteHeader(200)