Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop github.com/pkg/errors #212

Merged
merged 1 commit into from
Apr 23, 2024
Merged
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381
github.com/mitchellh/go-homedir v1.1.0
github.com/pelletier/go-toml v1.9.5
github.com/pkg/errors v0.9.1
github.com/pkg/errors v0.9.1 // indirect
// pinned to pull in 386 arch fix: https://github.com/scylladb/go-set/commit/cc7b2070d91ebf40d233207b633e28f5bd8f03a5
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e
github.com/sergi/go-diff v1.2.0
Expand Down
2 changes: 1 addition & 1 deletion internal/podman/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package podman

import (
"context"
"errors"
"fmt"
"os"
"time"

"github.com/adrg/xdg"
"github.com/docker/docker/client"
"github.com/pkg/errors"
"github.com/spf13/afero"

"github.com/anchore/stereoscope/internal/log"
Expand Down
4 changes: 2 additions & 2 deletions internal/podman/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package podman
import (
"bufio"
"context"
"errors"
"fmt"
"net"
"net/http"
Expand All @@ -13,7 +14,6 @@ import (
"time"

"github.com/docker/docker/pkg/homedir"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/knownhosts"

Expand Down Expand Up @@ -74,7 +74,7 @@ func getSigners(keyPath, passphrase string) (signers []ssh.Signer, err error) {

s, err := getSignerFromPrivateKey(key, []byte(passphrase))
if err != nil {
return nil, errors.Wrapf(err, "failed to parse identity %q", keyPath)
return nil, fmt.Errorf("failed to parse identity %q: %w", keyPath, err)
}

signers = append(signers, s)
Expand Down
2 changes: 1 addition & 1 deletion pkg/file/tarutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package file

import (
"archive/tar"
"errors"
"fmt"
"io"
"os"
"path/filepath"
"strings"

"github.com/pkg/errors"
"github.com/spf13/afero"

"github.com/anchore/stereoscope/internal/log"
Expand Down
13 changes: 6 additions & 7 deletions pkg/image/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strings"

"github.com/containerd/containerd/errdefs"
"github.com/pkg/errors"
)

var (
Expand Down Expand Up @@ -69,14 +68,14 @@ func (p *Platform) String() string {
func parse(specifier string) (*Platform, error) {
if strings.Contains(specifier, "*") {
// TODO(stevvooe): need to work out exact wildcard handling
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: wildcards not yet supported", specifier)
return nil, fmt.Errorf("%q: wildcards not yet supported: %w", specifier, errdefs.ErrInvalidArgument)
}

parts := strings.Split(specifier, "/")

for _, part := range parts {
if !specifierRe.MatchString(part) {
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%q is an invalid component of %q: platform specifier component must match %q", part, specifier, specifierRe.String())
return nil, fmt.Errorf("%q is an invalid component of %q: platform specifier component must match %q: %w", part, specifier, specifierRe.String(), errdefs.ErrInvalidArgument)
}
}

Expand All @@ -96,7 +95,7 @@ func parse(specifier string) (*Platform, error) {
return p, nil
}

return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: unknown operating system or architecture", specifier)
return nil, fmt.Errorf("%q: unknown operating system or architecture: %w", specifier, errdefs.ErrInvalidArgument)
case 2:
// In this case, we treat as a regular os/arch pair or architecture/variant pair.
var archGuess, variantGuess string
Expand All @@ -113,7 +112,7 @@ func parse(specifier string) (*Platform, error) {
return p, nil
}

return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: unknown operating system or architecture", specifier)
return nil, fmt.Errorf("%q: unknown operating system or architecture: %w", specifier, errdefs.ErrInvalidArgument)
case 3:
// we have a fully specified variant, this is rare
if osGuess := normalizeOS(parts[0]); isKnownOS(osGuess) {
Expand All @@ -128,10 +127,10 @@ func parse(specifier string) (*Platform, error) {
return p, nil
}

return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: unknown operating system or architecture", specifier)
return nil, fmt.Errorf("%q: unknown operating system or architecture: %w", specifier, errdefs.ErrInvalidArgument)
}

return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: cannot parse platform specifier", specifier)
return nil, fmt.Errorf("%q: cannot parse platform specifier: %w", specifier, errdefs.ErrInvalidArgument)
}

// These function are generated from https://golang.org/src/go/build/syslist.go.
Expand Down
Loading