From 6468adb2dec5472906cffb3df501f1efc211ff87 Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Tue, 1 Aug 2023 20:31:09 +0800 Subject: [PATCH] rename Signed-off-by: Lixia (Sylvia) Lei --- registry/remote/example_test.go | 2 +- registry/remote/registry_test.go | 6 +++--- registry/remote/repository_test.go | 6 +++--- registry/remote/warning.go | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/registry/remote/example_test.go b/registry/remote/example_test.go index eca994d5..35502a94 100644 --- a/registry/remote/example_test.go +++ b/registry/remote/example_test.go @@ -738,7 +738,7 @@ func Example_handleWarning() { } // 1. specify HandleWarning repo.HandleWarning = func(warning remote.Warning) { - fmt.Printf("Warning from %s: %s\n", repo.Reference.Repository, warning.Value.Text) + fmt.Printf("Warning from %s: %s\n", repo.Reference.Repository, warning.Text) } ctx := context.Background() diff --git a/registry/remote/registry_test.go b/registry/remote/registry_test.go index 00ccf098..8f91c4e1 100644 --- a/registry/remote/registry_test.go +++ b/registry/remote/registry_test.go @@ -354,21 +354,21 @@ func TestRegistry_do(t *testing.T) { wantWarnings := []Warning{ { - Value: WarningValue{ + WarningValue: WarningValue{ Code: 299, Agent: "-", Text: "Test 1: Good warning.", }, }, { - Value: WarningValue{ + WarningValue: WarningValue{ Code: 299, Agent: "-", Text: "Test 3: Good warning.", }, }, { - Value: WarningValue{ + WarningValue: WarningValue{ Code: 299, Agent: "-", Text: "Test 6: Good warning.", diff --git a/registry/remote/repository_test.go b/registry/remote/repository_test.go index dd1a799d..fdd5e9ce 100644 --- a/registry/remote/repository_test.go +++ b/registry/remote/repository_test.go @@ -6919,21 +6919,21 @@ func TestRepository_do(t *testing.T) { wantWarnings := []Warning{ { - Value: WarningValue{ + WarningValue: WarningValue{ Code: 299, Agent: "-", Text: "Test 1: Good warning.", }, }, { - Value: WarningValue{ + WarningValue: WarningValue{ Code: 299, Agent: "-", Text: "Test 3: Good warning.", }, }, { - Value: WarningValue{ + WarningValue: WarningValue{ Code: 299, Agent: "-", Text: "Test 6: Good warning.", diff --git a/registry/remote/warning.go b/registry/remote/warning.go index a4b5eea1..a74d6470 100644 --- a/registry/remote/warning.go +++ b/registry/remote/warning.go @@ -61,8 +61,8 @@ type WarningValue struct { // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc3/spec.md#warnings // - https://www.rfc-editor.org/rfc/rfc7234#section-5.5 type Warning struct { - // Value is the value of the warning header. - Value WarningValue + // WarningValue is the value of the warning header. + WarningValue } // parseWarningHeader parses the warning header into WarningValue. @@ -90,10 +90,10 @@ func parseWarningHeader(header string) (WarningValue, error) { // warnings using handleWarning. func handleWarningHeaders(headers []string, handleWarning func(Warning)) { for _, h := range headers { - if wh, err := parseWarningHeader(h); err == nil { + if value, err := parseWarningHeader(h); err == nil { // ignore warnings in unexpected formats warning := Warning{ - Value: wh, + WarningValue: value, } handleWarning(warning) }