mirror of
https://github.com/helm/helm.git
synced 2026-02-18 18:29:23 -05:00
Merge pull request #31810 from mmorel-35/errorlint-pkg-5-dda0145
fix(pkg): errorlint linter
This commit is contained in:
commit
56d0d9374a
5 changed files with 10 additions and 5 deletions
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package action
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
|
@ -146,7 +147,7 @@ func TestValidateVersion(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := validateVersion(tt.args.ver); err != nil {
|
||||
if err != tt.wantErr {
|
||||
if !errors.Is(err, tt.wantErr) {
|
||||
t.Errorf("Expected {%v}, got {%v}", tt.wantErr, err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package cmd
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
|
|
@ -124,7 +125,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|||
histClient := action.NewHistory(cfg)
|
||||
histClient.Max = 1
|
||||
versions, err := histClient.Run(args[0])
|
||||
if err == driver.ErrReleaseNotFound || isReleaseUninstalled(versions) {
|
||||
if errors.Is(err, driver.ErrReleaseNotFound) || isReleaseUninstalled(versions) {
|
||||
// Only print this to stdout for table output
|
||||
if outfmt == output.Table {
|
||||
fmt.Fprintf(out, "Release %q does not exist. Installing it now.\n", args[0])
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package downloader
|
|||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
|
@ -376,7 +377,7 @@ func TestScanReposForURL(t *testing.T) {
|
|||
|
||||
// A lookup failure should produce an ErrNoOwnerRepo
|
||||
u = "https://no.such.repo/foo/bar-1.23.4.tgz"
|
||||
if _, err = c.scanReposForURL(u, rf); err != ErrNoOwnerRepo {
|
||||
if _, err = c.scanReposForURL(u, rf); !errors.Is(err, ErrNoOwnerRepo) {
|
||||
t.Fatalf("expected ErrNoOwnerRepo, got %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"bufio"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
|
@ -639,7 +640,7 @@ func TestIgnoreSkippableChartValidationError(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
if tc.Input != result {
|
||||
if !errors.Is(tc.Input, result) {
|
||||
t.Error("expected the result equal to input")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ package driver
|
|||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
|
@ -447,7 +448,7 @@ func TestSqlQuery(t *testing.T) {
|
|||
_, err := sqlDriver.Query(labelSetUnknown)
|
||||
if err == nil {
|
||||
t.Errorf("Expected error {%v}, got nil", ErrReleaseNotFound)
|
||||
} else if err != ErrReleaseNotFound {
|
||||
} else if !errors.Is(err, ErrReleaseNotFound) {
|
||||
t.Fatalf("failed to query for unknown smug-pigeon release: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue