diff --git a/attestation/material/material.go b/attestation/material/material.go index 801289ac..84394d33 100644 --- a/attestation/material/material.go +++ b/attestation/material/material.go @@ -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 } diff --git a/attestation/product/product.go b/attestation/product/product.go index 81a9a7da..3ef24571 100644 --- a/attestation/product/product.go +++ b/attestation/product/product.go @@ -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 } diff --git a/attestation/product/product_test.go b/attestation/product/product_test.go index ece998d9..76502b74 100644 --- a/attestation/product/product_test.go +++ b/attestation/product/product_test.go @@ -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) { diff --git a/cryptoutil/digestset.go b/cryptoutil/digestset.go index d97ef70a..ec291da4 100644 --- a/cryptoutil/digestset.go +++ b/cryptoutil/digestset.go @@ -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 @@ -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()) diff --git a/registry/option.go b/registry/option.go index 71ba1669..28591008 100644 --- a/registry/option.go +++ b/registry/option.go @@ -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 } @@ -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 }