Remove dependency on github.com/pkg/errors (#106)

This commit is contained in:
Jonny Stoten
2024-07-30 14:07:19 +01:00
committed by GitHub
parent a1c7bbb991
commit 91fdf7ece6
3 changed files with 4 additions and 6 deletions

2
go.mod
View File

@@ -16,7 +16,6 @@ require (
github.com/open-policy-agent/opa v0.67.0
github.com/opencontainers/image-spec v1.1.0
github.com/package-url/packageurl-go v0.1.3
github.com/pkg/errors v0.9.1
github.com/secure-systems-lab/go-securesystemslib v0.8.0
github.com/sigstore/cosign/v2 v2.3.0
github.com/sigstore/rekor v1.3.6
@@ -136,6 +135,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect

View File

@@ -9,7 +9,6 @@ import (
att "github.com/docker/attest/pkg/attestation"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/layout"
"github.com/pkg/errors"
)
// implementation of AttestationResolver that closes over attestations from an oci layout
@@ -140,5 +139,5 @@ func attestationManifestFromOCILayout(path string, platform *v1.Platform) (*atte
}
return attest, nil
}
return nil, errors.New("attestation manifest not found")
return nil, fmt.Errorf("attestation manifest not found")
}

View File

@@ -15,7 +15,6 @@ import (
"github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/common"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/package-url/packageurl-go"
"github.com/pkg/errors"
)
// ParsePlatform parses the provided platform string or attempts to obtain
@@ -82,7 +81,7 @@ func imageDescriptor(ix *v1.IndexManifest, platform *v1.Platform) (*v1.Descripto
return &m, nil
}
}
return nil, errors.New(fmt.Sprintf("no image found for platform %v", platform))
return nil, fmt.Errorf("no image found for platform %v", platform)
}
func attestationDigestForDigest(ix *v1.IndexManifest, imageDigest string, attestType string) (string, error) {
@@ -93,7 +92,7 @@ func attestationDigestForDigest(ix *v1.IndexManifest, imageDigest string, attest
}
}
}
return "", errors.New(fmt.Sprintf("no attestation found for image %s", imageDigest))
return "", fmt.Errorf("no attestation found for image %s", imageDigest)
}
func RefToPURL(ref string, platform *v1.Platform) (string, bool, error) {