Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)

// DeepCopyDescriptor copies a Descriptor, deeply copying its contents
// DeepCopyDescriptor copies a Descriptor, deeply copying its contents.
func DeepCopyDescriptor(original *v1.Descriptor) *v1.Descriptor {
tmp := *original
if original.URLs != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/manifests/manifests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ func TestAddInstance(t *testing.T) {
t.Fatalf("adding an instance without platform info failed in %s: %v", version, err)
}
o, err := list.findOCIv1(manifestDigest)
if o == nil || err != nil {
if err != nil {
t.Fatalf("adding an instance failed in %s: %v", version, err)
}
if o.Platform != nil {
if o != nil && o.Platform != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this changes the semantics — returning (nil, nil) would now fail.

That should never happen, and I think leaving this as just if o.Platform != nil (which o == nil crashing) would be fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would now fail.

I’m sorry, I meant “would not be detected as a problem by the test”.

t.Fatalf("added a Platform field (%+v) where none was expected: %v", o.Platform, err)
}
}
Expand Down