Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/checkout-4
Browse files Browse the repository at this point in the history
  • Loading branch information
jkjell authored Nov 15, 2023
2 parents 6905bb3 + 78ca945 commit c52f89d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
6 changes: 3 additions & 3 deletions attestation/material/material.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ type Attestor struct {
materials map[string]cryptoutil.DigestSet
}

func (a Attestor) Name() string {
func (a *Attestor) Name() string {
return Name
}

func (a Attestor) Type() string {
func (a *Attestor) Type() string {
return Type
}

func (rc *Attestor) RunType() attestation.RunType {
func (a *Attestor) RunType() attestation.RunType {
return RunType
}

Expand Down
6 changes: 3 additions & 3 deletions attestation/product/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ func fromDigestMap(digestMap map[string]cryptoutil.DigestSet) map[string]attesta
return products
}

func (a Attestor) Name() string {
func (a *Attestor) Name() string {
return Name
}

func (a Attestor) Type() string {
func (a *Attestor) Type() string {
return Type
}

func (rc *Attestor) RunType() attestation.RunType {
func (a *Attestor) RunType() attestation.RunType {
return RunType
}

Expand Down
3 changes: 2 additions & 1 deletion attestation/product/product_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func TestFromDigestMap(t *testing.T) {
testDigestSet["test"] = testDigest
result := fromDigestMap(testDigestSet)
assert.Len(t, result, 1)
assert.True(t, result["test"].Digest.Equal(testDigest))
digest := result["test"].Digest
assert.True(t, digest.Equal(testDigest))
}

func TestAttestorName(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions cryptoutil/digestset.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ func HashFromString(name string) (crypto.Hash, error) {
// Equal returns true if every digest for hash functions both artifacts have in common are equal.
// If the two artifacts don't have any digests from common hash functions, equal will return false.
// If any digest from common hash functions differ between the two artifacts, equal will return false.
func (first DigestSet) Equal(second DigestSet) bool {
func (ds *DigestSet) Equal(second DigestSet) bool {
hasMatchingDigest := false
for hash, digest := range first {
for hash, digest := range *ds {
otherDigest, ok := second[hash]
if !ok {
continue
Expand All @@ -114,9 +114,9 @@ func (first DigestSet) Equal(second DigestSet) bool {
return hasMatchingDigest
}

func (ds DigestSet) ToNameMap() (map[string]string, error) {
func (ds *DigestSet) ToNameMap() (map[string]string, error) {
nameMap := make(map[string]string)
for hash, digest := range ds {
for hash, digest := range *ds {
name, ok := hashNames[hash]
if !ok {
return nameMap, ErrUnsupportedHash(hash.String())
Expand Down
8 changes: 4 additions & 4 deletions registry/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type ConfigOption[T any, TOption Option] struct {
setter func(T, TOption) (T, error)
}

func (co ConfigOption[T, TOption]) Name() string {
func (co *ConfigOption[T, TOption]) Name() string {
if len(co.prefix) == 0 {
return co.name
}
Expand All @@ -49,15 +49,15 @@ func (co *ConfigOption[T, TOption]) SetPrefix(prefix string) {
co.prefix = prefix
}

func (co ConfigOption[T, TOption]) DefaultVal() TOption {
func (co *ConfigOption[T, TOption]) DefaultVal() TOption {
return co.defaultVal
}

func (co ConfigOption[T, TOption]) Description() string {
func (co *ConfigOption[T, TOption]) Description() string {
return co.description
}

func (co ConfigOption[T, TOption]) Setter() func(T, TOption) (T, error) {
func (co *ConfigOption[T, TOption]) Setter() func(T, TOption) (T, error) {
return co.setter
}

Expand Down

0 comments on commit c52f89d

Please sign in to comment.