aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-03-07 23:02:38 +0700
committerShulhan <ms@kilabit.info>2023-03-07 23:02:59 +0700
commit1ea62df86d5674fce80a4c5a474086f8e56919d6 (patch)
tree3126d10e382671d20c9e43a35f218e87003d1cb9
parent4b4e44bed548115f2c46f4521e8fe2971eb12fc5 (diff)
downloadbeku-1ea62df86d5674fce80a4c5a474086f8e56919d6.tar.xz
go.mod: set minimum go version to 1.18 and update all dependencies
This changes remove the "-cache" and "-testcache" options when running GoClean due to both of this options case an exit status 1 on Go 1.18.
-rw-r--r--beku_test.go18
-rw-r--r--go.mod12
-rw-r--r--go.sum44
-rw-r--r--package.go27
4 files changed, 40 insertions, 61 deletions
diff --git a/beku_test.go b/beku_test.go
index e972b64..7b23cc3 100644
--- a/beku_test.go
+++ b/beku_test.go
@@ -9,6 +9,7 @@ import (
"go/build"
"log"
"os"
+ "path/filepath"
"testing"
"github.com/shuLhan/share/lib/debug"
@@ -23,12 +24,12 @@ const (
)
var (
- testEnv *Env //nolint: gochecknoglobals
- testGitPkgCur *Package //nolint: gochecknoglobals
- testGitPkgNew *Package //nolint: gochecknoglobals
- testGitPkgInstall *Package //nolint: gochecknoglobals
+ testEnv *Env
+ testGitPkgCur *Package
+ testGitPkgNew *Package
+ testGitPkgInstall *Package
- testGitRepoSrcLocal = "/testdata/beku_test.git" //nolint: gochecknoglobals
+ testGitRepoSrcLocal = `/testdata/beku_test.git`
)
func TestMain(m *testing.M) {
@@ -39,7 +40,7 @@ func TestMain(m *testing.M) {
log.Fatal(err)
}
- testGOPATH += "/testdata"
+ testGOPATH = filepath.Join(testGOPATH, `testdata`)
build.Default.GOPATH = testGOPATH
defer func() {
@@ -54,6 +55,11 @@ func TestMain(m *testing.M) {
log.Fatal(err)
}
+ err = os.RemoveAll(testEnv.dirSrc)
+ if err != nil {
+ log.Fatal(err)
+ }
+
testGitPkgCur, _ = NewPackage(testEnv.dirSrc, testGitRepo, testGitRepo)
testGitPkgNew, _ = NewPackage(testEnv.dirSrc, testGitRepo, testGitRepo)
testGitPkgInstall, _ = NewPackage(testEnv.dirSrc, testGitRepo, testGitRepo)
diff --git a/go.mod b/go.mod
index 57d4406..ee4ee28 100644
--- a/go.mod
+++ b/go.mod
@@ -1,10 +1,12 @@
module github.com/shuLhan/beku
+go 1.18
+
require (
- github.com/shuLhan/share v0.33.0
- golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
- golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect
- golang.org/x/tools v0.1.9
+ github.com/shuLhan/share v0.44.0
+ golang.org/x/tools v0.1.12
)
-go 1.11
+require golang.org/x/sys v0.5.0 // indirect
+
+//replace github.com/shuLhan/share => ../share
diff --git a/go.sum b/go.sum
index fefc7b2..7b9d4db 100644
--- a/go.sum
+++ b/go.sum
@@ -1,38 +1,6 @@
-github.com/shuLhan/share v0.33.0 h1:fM/yLmAzqMECP3Gp1lFH/l4zH1UZVCvgn8BLuPI2Dnc=
-github.com/shuLhan/share v0.33.0/go.mod h1:6YvVpuViRgLm4e+8AIh1izGaWgV5lyuj53H19GKCZzI=
-github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
-golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
-golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
-golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo=
-golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
-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=
-golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=
-golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+github.com/shuLhan/share v0.44.0 h1:Afom8pQrzNYtUZM53y+eqlZw5lkFm7bgl3QjZ3ARsgg=
+github.com/shuLhan/share v0.44.0/go.mod h1:BnjohSsgDFMeYQ0/ws7kzb1oABZdVbEwDNGbUhOLee4=
+golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
diff --git a/package.go b/package.go
index db3790d..1f45948 100644
--- a/package.go
+++ b/package.go
@@ -124,40 +124,43 @@ func (pkg *Package) Freeze() (err error) {
// GoClean will remove the package binaries and archives.
func (pkg *Package) GoClean() (err error) {
+ var logp = `GoClean`
+
_, err = os.Stat(pkg.FullPath)
if err != nil {
- err = nil
- return
+ if os.IsNotExist(err) {
+ return nil
+ }
+ return fmt.Errorf(`%s: %s`, logp, err)
}
- cmd := exec.Command("go", "clean", "-i", "-cache", "-testcache", "./...")
+ cmd := exec.Command("go", "clean", "-i", "./...")
cmd.Dir = pkg.FullPath
cmd.Env = append(cmd.Env, "GO111MODULE=off")
cmd.Env = append(cmd.Env, "GOPATH="+build.Default.GOPATH)
cmd.Stdout = defStdout
cmd.Stderr = defStderr
- if debug.Value >= 1 {
- fmt.Printf("[PKG] GoClean %s >>> %s %s\n", pkg.ImportPath, cmd.Dir, cmd.Args)
- }
-
err = cmd.Run()
if err != nil {
- err = fmt.Errorf("GoClean: %s", err)
- return
+ return fmt.Errorf(`%s: %s`, logp, err)
}
- return
+ return nil
}
// Install a package. Clone package "src" directory, set to the latest tag if
// exist or to the latest commit, and scan dependencies.
func (pkg *Package) Install() (err error) {
+ var logp = `Install`
+
if pkg.vcsMode == VCSModeGit {
err = pkg.gitInstall()
+ if err != nil {
+ return fmt.Errorf(`%s: %w`, logp, err)
+ }
}
-
- return
+ return nil
}
// IsEqual will return true if current package have the same import path,