J Guerreiro преди 3 години
родител
ревизия
d83c5ca5a1
променени са 7 файла, в които са добавени 18 реда и са изтрити 13 реда
  1. 1 1
      ci.Dockerfile
  2. 3 2
      cmd.go
  3. 2 3
      go.mod
  4. 4 0
      go.sum
  5. 5 5
      install.go
  6. 2 1
      pkg/dep/depCheck.go
  7. 1 1
      pkg/settings/parser/parser.go

+ 1 - 1
ci.Dockerfile

@@ -7,5 +7,5 @@ COPY go.mod .
 
 RUN pacman -Syu --overwrite=* --needed --noconfirm go fakeroot binutils gcc make git gettext && \
     rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/* && \
-    curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.43.0 && \
+    curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.44.0 && \
     go mod download

+ 3 - 2
cmd.go

@@ -3,6 +3,7 @@ package main
 import (
 	"bufio"
 	"context"
+	"errors"
 	"fmt"
 	"net/http"
 	"os"
@@ -187,7 +188,7 @@ func handleCmd(ctx context.Context, cmdArgs *parser.Arguments, dbExecutor db.Exe
 		return handleYay(ctx, cmdArgs, dbExecutor)
 	}
 
-	return fmt.Errorf(gotext.Get("unhandled operation"))
+	return errors.New(gotext.Get("unhandled operation"))
 }
 
 // getFilter returns filter function which can keep packages which were only
@@ -198,7 +199,7 @@ func getFilter(cmdArgs *parser.Arguments) (upgrade.Filter, error) {
 
 	switch {
 	case deps && explicit:
-		return nil, fmt.Errorf(gotext.Get("invalid option: '--deps' and '--explicit' may not be used together"))
+		return nil, errors.New(gotext.Get("invalid option: '--deps' and '--explicit' may not be used together"))
 	case deps:
 		return func(pkg upgrade.Upgrade) bool {
 			return pkg.Reason == alpm.PkgReasonDepend

+ 2 - 3
go.mod

@@ -1,15 +1,14 @@
 module github.com/Jguer/yay/v11
 
 require (
-	github.com/Jguer/aur v1.0.0
+	github.com/Jguer/aur v1.0.1
 	github.com/Jguer/go-alpm/v2 v2.0.6
 	github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5
 	github.com/Morganamilo/go-srcinfo v1.0.0
 	github.com/bradleyjkemp/cupaloy v2.3.0+incompatible
 	github.com/leonelquinteros/gotext v1.5.0
-	github.com/pkg/errors v0.9.1
 	github.com/stretchr/testify v1.7.0
-	golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
+	golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a
 	golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
 	golang.org/x/text v0.3.7 // indirect
 	gopkg.in/h2non/gock.v1 v1.0.15

+ 4 - 0
go.sum

@@ -1,5 +1,7 @@
 github.com/Jguer/aur v1.0.0 h1:/1oCUucvFGA5kq1vA50UstQoj5hkRQuAKYp/pyBgOz0=
 github.com/Jguer/aur v1.0.0/go.mod h1:1/SQjhWahmk2xKcmAm6XO1zGqK8HgYw3xlJM6a7845E=
+github.com/Jguer/aur v1.0.1 h1:+GDOq0RuVn7CXpXzd8W85/+hPNDYonRZ3ONPm87e1jo=
+github.com/Jguer/aur v1.0.1/go.mod h1:1/SQjhWahmk2xKcmAm6XO1zGqK8HgYw3xlJM6a7845E=
 github.com/Jguer/go-alpm/v2 v2.0.6 h1:VLavW5qFk/TJRHT3Gg7ClDukU4MNWdfkWM9yLxVkYyQ=
 github.com/Jguer/go-alpm/v2 v2.0.6/go.mod h1:zU4iKCtNkDARfj5BrKJXYAQ5nIjtZbySfa0paboSmTQ=
 github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5 h1:TMscPjkb1ThXN32LuFY5bEYIcXZx3YlwzhS1GxNpn/c=
@@ -36,6 +38,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
 golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a h1:ppl5mZgokTT8uPkmYOyEUmPTr3ypaKkg5eFOGrAmxxE=
+golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

+ 5 - 5
install.go

@@ -39,7 +39,7 @@ func asdeps(ctx context.Context, cmdArgs *parser.Arguments, pkgs []string) (err
 	err = config.Runtime.CmdBuilder.Show(config.Runtime.CmdBuilder.BuildPacmanCmd(ctx,
 		cmdArgs, config.Runtime.Mode, settings.NoConfirm))
 	if err != nil {
-		return fmt.Errorf(gotext.Get("error updating package install reason to dependency"))
+		return errors.New(gotext.Get("error updating package install reason to dependency"))
 	}
 
 	return nil
@@ -57,7 +57,7 @@ func asexp(ctx context.Context, cmdArgs *parser.Arguments, pkgs []string) (err e
 	err = config.Runtime.CmdBuilder.Show(config.Runtime.CmdBuilder.BuildPacmanCmd(ctx,
 		cmdArgs, config.Runtime.Mode, settings.NoConfirm))
 	if err != nil {
-		return fmt.Errorf(gotext.Get("error updating package install reason to explicit"))
+		return errors.New(gotext.Get("error updating package install reason to explicit"))
 	}
 
 	return nil
@@ -85,7 +85,7 @@ func install(ctx context.Context, cmdArgs *parser.Arguments, dbExecutor db.Execu
 		if config.CombinedUpgrade {
 			if refreshArg {
 				if errR := earlyRefresh(ctx, cmdArgs); errR != nil {
-					return fmt.Errorf(gotext.Get("error refreshing databases"))
+					return errors.New(gotext.Get("error refreshing databases"))
 				}
 			}
 		} else if refreshArg || sysupgradeArg || len(cmdArgs.Targets) > 0 {
@@ -563,14 +563,14 @@ func gitMerge(ctx context.Context, path, name string) error {
 		config.Runtime.CmdBuilder.BuildGitCmd(ctx,
 			filepath.Join(path, name), "reset", "--hard", "HEAD"))
 	if err != nil {
-		return fmt.Errorf(gotext.Get("error resetting %s: %s", name, stderr))
+		return errors.New(gotext.Get("error resetting %s: %s", name, stderr))
 	}
 
 	_, stderr, err = config.Runtime.CmdBuilder.Capture(
 		config.Runtime.CmdBuilder.BuildGitCmd(ctx,
 			filepath.Join(path, name), "merge", "--no-edit", "--ff"))
 	if err != nil {
-		return fmt.Errorf(gotext.Get("error merging %s: %s", name, stderr))
+		return errors.New(gotext.Get("error merging %s: %s", name, stderr))
 	}
 
 	return nil

+ 2 - 1
pkg/dep/depCheck.go

@@ -1,6 +1,7 @@
 package dep
 
 import (
+	"errors"
 	"fmt"
 	"os"
 	"strings"
@@ -193,7 +194,7 @@ func (dp *Pool) CheckConflicts(useAsk, noConfirm, noDeps bool) (stringset.MapStr
 	if len(conflicts) > 0 {
 		if !useAsk {
 			if noConfirm {
-				return nil, fmt.Errorf(gotext.Get("package conflicts can not be resolved with noconfirm, aborting"))
+				return nil, errors.New(gotext.Get("package conflicts can not be resolved with noconfirm, aborting"))
 			}
 
 			text.Errorln(gotext.Get("Conflicting packages will have to be confirmed manually"))

+ 1 - 1
pkg/settings/parser/parser.go

@@ -2,12 +2,12 @@ package parser
 
 import (
 	"bufio"
+	"errors"
 	"fmt"
 	"os"
 	"strings"
 
 	"github.com/leonelquinteros/gotext"
-	"github.com/pkg/errors"
 )
 
 type Option struct {