Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
  • Loading branch information
Wwwsylvia committed Aug 1, 2023
1 parent edf11fa commit 5746e0b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion registry/remote/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions registry/remote/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
6 changes: 3 additions & 3 deletions registry/remote/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
8 changes: 4 additions & 4 deletions registry/remote/warning.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 5746e0b

Please sign in to comment.