Skip to content

Commit 57e7904

Browse files
committed
test(vex): satisfy linters in oci_test.go
Replace []byte(fmt.Sprintf...) with fmt.Appendf (modernize), use %q for the quoted strings in the docker config template (gocritic), and rename the unused test-setup parameter to _ (revive).
1 parent fe41eb8 commit 57e7904

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/vex/oci_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ func setUpDockerConfig(t *testing.T, registryHost, user, password string) {
241241
configDir := t.TempDir()
242242
t.Setenv("DOCKER_CONFIG", configDir)
243243

244-
encoded := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", user, password)))
245-
config := fmt.Sprintf(`{"auths":{"%s":{"auth":"%s"}}}`, registryHost, encoded)
244+
encoded := base64.StdEncoding.EncodeToString(fmt.Appendf(nil, "%s:%s", user, password))
245+
config := fmt.Sprintf(`{"auths":{%q:{"auth":%q}}}`, registryHost, encoded)
246246
require.NoError(t, os.WriteFile(filepath.Join(configDir, "config.json"), []byte(config), 0o600))
247247
}
248248

@@ -319,7 +319,7 @@ func TestRetrieveVEXAttestation(t *testing.T) {
319319
},
320320
{
321321
name: "image not found",
322-
setup: func(t *testing.T) string {
322+
setup: func(_ *testing.T) string {
323323
return registryHost + "/debian/missing:latest"
324324
},
325325
wantErr: "failed to resolve OCI digest",

0 commit comments

Comments
 (0)