use fmt and errors pkgs for installer plugin files

Signed-off-by: James Sheppard <jgsheppa@protonmail.com>
pull/12063/head
James Sheppard 2 years ago
parent c39d980ebf
commit 61cffdfaf0

@ -19,6 +19,7 @@ import (
"archive/tar" "archive/tar"
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"fmt"
"io" "io"
"os" "os"
"path" "path"
@ -78,7 +79,7 @@ func NewExtractor(source string) (Extractor, error) {
return extractor, nil return extractor, nil
} }
} }
return nil, errors.Errorf("no extractor implemented yet for %s", source) return nil, fmt.Errorf("no extractor implemented yet for %s", source)
} }
// NewHTTPInstaller creates a new HttpInstaller. // NewHTTPInstaller creates a new HttpInstaller.
@ -151,7 +152,7 @@ func (i *HTTPInstaller) Install() error {
// Update updates a local repository // Update updates a local repository
// Not implemented for now since tarball most likely will be packaged by version // Not implemented for now since tarball most likely will be packaged by version
func (i *HTTPInstaller) Update() error { func (i *HTTPInstaller) Update() error {
return errors.Errorf("method Update() not implemented for HttpInstaller") return fmt.Errorf("method Update() not implemented for HttpInstaller")
} }
// Path is overridden because we want to join on the plugin name not the file name // Path is overridden because we want to join on the plugin name not the file name
@ -261,7 +262,7 @@ func (g *TarGzExtractor) Extract(buffer *bytes.Buffer, targetDir string) error {
case tar.TypeXGlobalHeader, tar.TypeXHeader: case tar.TypeXGlobalHeader, tar.TypeXHeader:
continue continue
default: default:
return errors.Errorf("unknown type: %b in %s", header.Typeflag, header.Name) return fmt.Errorf("unknown type: %b in %s", header.Typeflag, header.Name)
} }
} }
return nil return nil

@ -29,8 +29,6 @@ import (
"syscall" "syscall"
"testing" "testing"
"github.com/pkg/errors"
"helm.sh/helm/v3/internal/test/ensure" "helm.sh/helm/v3/internal/test/ensure"
"helm.sh/helm/v3/pkg/getter" "helm.sh/helm/v3/pkg/getter"
"helm.sh/helm/v3/pkg/helmpath" "helm.sh/helm/v3/pkg/helmpath"
@ -150,7 +148,7 @@ func TestHTTPInstallerNonExistentVersion(t *testing.T) {
// inject fake http client responding with error // inject fake http client responding with error
httpInstaller.getter = &TestHTTPGetter{ httpInstaller.getter = &TestHTTPGetter{
MockError: errors.Errorf("failed to download plugin for some reason"), MockError: fmt.Errorf("failed to download plugin for some reason"),
} }
// attempt to install the plugin // attempt to install the plugin

@ -16,6 +16,7 @@ limitations under the License.
package installer package installer
import ( import (
"errors"
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
@ -23,8 +24,6 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/pkg/errors"
"helm.sh/helm/v3/pkg/plugin" "helm.sh/helm/v3/pkg/plugin"
) )

@ -16,12 +16,13 @@ limitations under the License.
package installer // import "helm.sh/helm/v3/pkg/plugin/installer" package installer // import "helm.sh/helm/v3/pkg/plugin/installer"
import ( import (
"errors"
"fmt"
"os" "os"
"sort" "sort"
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/Masterminds/vcs" "github.com/Masterminds/vcs"
"github.com/pkg/errors"
"helm.sh/helm/v3/internal/third_party/dep/fs" "helm.sh/helm/v3/internal/third_party/dep/fs"
"helm.sh/helm/v3/pkg/helmpath" "helm.sh/helm/v3/pkg/helmpath"
@ -144,7 +145,7 @@ func (i *VCSInstaller) solveVersion(repo vcs.Repo) (string, error) {
} }
} }
return "", errors.Errorf("requested version %q does not exist for plugin %q", i.Version, i.Repo.Remote()) return "", fmt.Errorf("requested version %q does not exist for plugin %q", i.Version, i.Repo.Remote())
} }
// setVersion attempts to checkout the version // setVersion attempts to checkout the version

Loading…
Cancel
Save