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

chore(deps): bump github.com/golangci/golangci-lint from 1.31.0 to 1.32.2 #1882

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .golangci.yml
Expand Up @@ -18,3 +18,5 @@ linters:
- gofumpt
- gci
- nlreturn
- exhaustivestruct
- wrapcheck
4 changes: 3 additions & 1 deletion cmd/root.go
@@ -1,6 +1,7 @@
package cmd

import (
"errors"
"fmt"
"os"

Expand Down Expand Up @@ -33,7 +34,8 @@ func (cmd *rootCmd) Execute(args []string) {
if err := cmd.cmd.Execute(); err != nil {
var code = 1
var msg = "command failed"
if eerr, ok := err.(*exitError); ok {
var eerr = &exitError{}
if errors.As(err, &eerr) {
code = eerr.code
if eerr.details != "" {
msg = eerr.details
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -10,7 +10,7 @@ require (
github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e
github.com/client9/misspell v0.3.4
github.com/fatih/color v1.10.0
github.com/golangci/golangci-lint v1.31.0
github.com/golangci/golangci-lint v1.32.2
github.com/google/go-github/v28 v28.1.1
github.com/goreleaser/nfpm v1.9.0
github.com/hashicorp/go-version v1.2.1 // indirect
Expand Down
61 changes: 61 additions & 0 deletions go.sum

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions internal/client/client.go
Expand Up @@ -2,6 +2,7 @@
package client

import (
"errors"
"fmt"
"os"

Expand Down Expand Up @@ -85,6 +86,8 @@ func (e RetriableError) Error() string {
return e.Err.Error()
}

// NotImplementedError happens when trying to use something a client does not
// implement.
type NotImplementedError struct {
TokenType context.TokenType
}
Expand All @@ -93,7 +96,7 @@ func (e NotImplementedError) Error() string {
return fmt.Sprintf("not implemented for %s", e.TokenType)
}

// IsNotImplementedErr returns true if given error is a NotImplementedError.
func IsNotImplementedErr(err error) bool {
_, ok := err.(NotImplementedError)
return ok
return errors.As(err, &NotImplementedError{})
}
8 changes: 4 additions & 4 deletions internal/pipe/archive/archive.go
Expand Up @@ -146,7 +146,7 @@ func create(ctx *context.Context, arch config.Archive, binaries []*artifact.Arti
archiveFile, err := os.Create(archivePath)
if err != nil {
lock.Unlock()
return fmt.Errorf("failed to create directory %s: %s", archivePath, err.Error())
return fmt.Errorf("failed to create directory %s: %w", archivePath, err)
}
lock.Unlock()
defer archiveFile.Close()
Expand All @@ -166,16 +166,16 @@ func create(ctx *context.Context, arch config.Archive, binaries []*artifact.Arti

files, err := findFiles(template, arch)
if err != nil {
return fmt.Errorf("failed to find files to archive: %s", err.Error())
return fmt.Errorf("failed to find files to archive: %w", err)
}
for _, f := range files {
if err = a.Add(f, f); err != nil {
return fmt.Errorf("failed to add %s to the archive: %s", f, err.Error())
return fmt.Errorf("failed to add %s to the archive: %w", f, err)
}
}
for _, binary := range binaries {
if err := a.Add(binary.Name, binary.Path); err != nil {
return fmt.Errorf("failed to add %s -> %s to the archive: %s", binary.Path, binary.Name, err.Error())
return fmt.Errorf("failed to add %s -> %s to the archive: %w", binary.Path, binary.Name, err)
}
}
ctx.Artifacts.Add(&artifact.Artifact{
Expand Down
2 changes: 1 addition & 1 deletion internal/pipe/before/before.go
Expand Up @@ -39,7 +39,7 @@ func (Pipe) Run(ctx *context.Context) error {
out, err := cmd.CombinedOutput()
log.WithField("cmd", step).Debug(string(out))
if err != nil {
return fmt.Errorf("hook failed: %s: %s; output: %s", step, err.Error(), string(out))
return fmt.Errorf("hook failed: %s: %w; output: %s", step, err, string(out))
}
}
return nil
Expand Down
1 change: 0 additions & 1 deletion internal/pipe/changelog/changelog.go
Expand Up @@ -214,7 +214,6 @@ func previous(tag string) (result string, err error) {
return
}

// nolint: gochecknoglobals
var validSHA1 = regexp.MustCompile(`^[a-fA-F0-9]{40}$`)

// isSHA1 te lets us know if the ref is a SHA1 or not.
Expand Down
8 changes: 5 additions & 3 deletions internal/pipe/pipe.go
@@ -1,7 +1,10 @@
// Package pipe provides generic erros for pipes to use.
package pipe

import "strings"
import (
"errors"
"strings"
)

// ErrSnapshotEnabled happens when goreleaser is running in snapshot mode.
// It usually means that publishing and maybe some validations were skipped.
Expand All @@ -21,8 +24,7 @@ var ErrSkipValidateEnabled = Skip("validation is disabled")

// IsSkip returns true if the error is an ErrSkip.
func IsSkip(err error) bool {
_, ok := err.(ErrSkip)
return ok
return errors.As(err, &ErrSkip{})
}

// ErrSkip occurs when a pipe is skipped for some reason.
Expand Down
7 changes: 2 additions & 5 deletions internal/pipe/release/release.go
Expand Up @@ -189,19 +189,16 @@ func upload(ctx *context.Context, cli client.Client, releaseID string, artifact
}

var err error
loop:
for try < 10 {
err = tryUpload()
if err == nil {
return nil
}
switch err.(type) {
case client.RetriableError:
if errors.As(err, &client.RetriableError{}) {
time.Sleep(time.Duration(try*50) * time.Millisecond)
continue
default:
break loop
}
break
}

return fmt.Errorf("failed to upload %s after %d tries: %w", artifact.Name, try, err)
Expand Down
4 changes: 2 additions & 2 deletions internal/testlib/skip.go
@@ -1,6 +1,7 @@
package testlib

import (
"errors"
"testing"

"github.com/goreleaser/goreleaser/internal/pipe"
Expand All @@ -9,6 +10,5 @@ import (

// AssertSkipped asserts that a pipe was skipped.
func AssertSkipped(t *testing.T, err error) {
_, ok := err.(pipe.ErrSkip)
require.True(t, ok, "expected a pipe.ErrSkip but got %v", err)
require.True(t, errors.As(err, &pipe.ErrSkip{}), "expected a pipe.ErrSkip but got %v", err)
}