Skip to content

Commit 46b74d3

Browse files
authored
Bump deps and Go versions (#63)
Upgrade release build to use Go 1.20.x. Bump go.mod deps. Add testing on Go 1.21. Remove usage of deprecated io/ioutil.
1 parent a2346ae commit 46b74d3

File tree

11 files changed

+49
-58
lines changed

11 files changed

+49
-58
lines changed

.github/workflows/go.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ jobs:
1515
strategy:
1616
matrix:
1717
go-version:
18-
- 1.18
19-
- 1.19
18+
- '1.20'
19+
- '1.21'
2020
steps:
2121
- uses: actions/checkout@v3
2222

2323
- name: set up Go
24-
uses: actions/setup-go@v3
24+
uses: actions/setup-go@v4
2525
with:
2626
go-version: ${{ matrix.go-version }}
2727

@@ -39,43 +39,43 @@ jobs:
3939
strategy:
4040
matrix:
4141
go-version:
42-
- 1.18
43-
- 1.19
42+
- '1.20'
43+
- '1.21'
4444
steps:
4545
- uses: actions/checkout@v3
4646

4747
- name: set up Go
48-
uses: actions/setup-go@v3
48+
uses: actions/setup-go@v4
4949
with:
5050
go-version: ${{ matrix.go-version }}
5151

5252
- name: go test
5353
run: go test ./...
5454

5555
test-macos:
56-
name: Go Test (macOS 12) (1.18)
56+
name: Go Test (macOS 12) (1.20)
5757
runs-on: macos-12
5858
steps:
5959
- uses: actions/checkout@v3
6060

6161
- name: set up Go
62-
uses: actions/setup-go@v3
62+
uses: actions/setup-go@v4
6363
with:
64-
go-version: 1.18
64+
go-version: '1.20'
6565

6666
- name: go test
6767
run: go test ./...
6868

6969
test-windows:
70-
name: Go Test (Windows) (1.18)
70+
name: Go Test (Windows) (1.20)
7171
runs-on: windows-latest
7272
steps:
7373
- uses: actions/checkout@v3
7474

7575
- name: set up Go
76-
uses: actions/setup-go@v3
76+
uses: actions/setup-go@v4
7777
with:
78-
go-version: 1.18
78+
go-version: '1.20'
7979

8080
- name: go test
81-
run: go test ./...
81+
run: go test -timeout 15m ./...

.github/workflows/golangci-lint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
name: golangci-lint
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/setup-go@v3
19+
- uses: actions/setup-go@v4
2020
with:
21-
go-version: 1.18
21+
go-version: '1.20'
2222

2323
- uses: actions/checkout@v3
2424

@@ -31,4 +31,4 @@ jobs:
3131
- name: golangci-lint
3232
uses: golangci/golangci-lint-action@v3
3333
with:
34-
version: v1.47.0
34+
version: v1.54.0

.github/workflows/goreleaser.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
fetch-depth: 0
1818
-
1919
name: Set up Go
20-
uses: actions/setup-go@v3
20+
uses: actions/setup-go@v4
2121
with:
22-
go-version: '1.18'
22+
go-version: '1.20'
2323
-
2424
name: Run GoReleaser
2525
uses: goreleaser/goreleaser-action@v3

.golangci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ linters:
1818
- typecheck
1919
- unused
2020
- varcheck
21-
- depguard
2221
- errorlint
2322
- gofumpt
2423
- goimports

binrepo.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package gvm
33
import (
44
"encoding/xml"
55
"fmt"
6-
"io/ioutil"
76
"net/http"
87
"net/url"
98
"os"
@@ -17,7 +16,7 @@ var reGostoreVersion = regexp.MustCompile(`go(.*)\.(.*)-(.*)\..*`)
1716
func (m *Manager) installBinary(version *GoVersion) (string, error) {
1817
godir := m.versionDir(version)
1918

20-
tmp, err := ioutil.TempDir("", godir)
19+
tmp, err := os.MkdirTemp("", godir)
2120
if err != nil {
2221
return "", err
2322
}

cmd/gvm/gvm.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"os"
66
"runtime"
77
"runtime/debug"
@@ -95,7 +95,7 @@ func main() {
9595
if *debug {
9696
logrus.SetOutput(os.Stderr)
9797
} else {
98-
logrus.SetOutput(ioutil.Discard)
98+
logrus.SetOutput(io.Discard)
9999
}
100100
return nil
101101
})

go.mod

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
module github.com/andrewkroh/gvm
22

3-
go 1.17
3+
go 1.20
44

55
require (
66
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
77
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
8-
github.com/hashicorp/go-version v1.2.0
9-
github.com/otiai10/copy v1.2.0
10-
github.com/sirupsen/logrus v1.4.2
11-
github.com/stretchr/testify v1.3.0
8+
github.com/hashicorp/go-version v1.6.0
9+
github.com/otiai10/copy v1.12.0
10+
github.com/sirupsen/logrus v1.9.3
11+
github.com/stretchr/testify v1.7.0
1212
gopkg.in/alecthomas/kingpin.v2 v2.2.6
1313
)
1414

1515
require (
1616
github.com/davecgh/go-spew v1.1.1 // indirect
17-
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
1817
github.com/pmezard/go-difflib v1.0.0 // indirect
19-
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 // indirect
18+
golang.org/x/sys v0.11.0 // indirect
19+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
2020
)

go.sum

+16-20
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,24 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
55
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
66
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
77
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8-
github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
9-
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
10-
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
11-
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
12-
github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k=
13-
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
14-
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
15-
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
16-
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
17-
github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc=
18-
github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
8+
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
9+
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
10+
github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY=
11+
github.com/otiai10/copy v1.12.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww=
12+
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks=
1913
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2014
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
21-
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
22-
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
15+
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
16+
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
2317
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
24-
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
25-
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
26-
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
27-
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
28-
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
29-
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 h1:A9i04dxx7Cribqbs8jf3FQLogkL/CV2YN7hj9KWJCkc=
30-
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
18+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
19+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
20+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
21+
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
22+
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3123
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
3224
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
25+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
26+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
27+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
28+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

gvm.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package gvm
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
76
"os"
87
"path/filepath"
98
"runtime"
@@ -192,7 +191,7 @@ func (m *Manager) Remove(version *GoVersion) error {
192191

193192
// Installed returns all installed go version
194193
func (m *Manager) Installed() ([]*GoVersion, error) {
195-
files, err := ioutil.ReadDir(m.versionsDir)
194+
files, err := os.ReadDir(m.versionsDir)
196195
if err != nil {
197196
return nil, err
198197
}

srcrepo.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package gvm
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
76
"log"
87
"os"
98
"path/filepath"
@@ -90,7 +89,7 @@ func (m *Manager) installSrc(version *GoVersion) (string, error) {
9089
godir := m.versionDir(version)
9190

9291
log.Println("create temp directory")
93-
tmpRoot, err := ioutil.TempDir("", godir)
92+
tmpRoot, err := os.MkdirTemp("", godir)
9493
if err != nil {
9594
return "", err
9695
}
@@ -138,7 +137,7 @@ func buildGo(log logrus.FieldLogger, buildDir, repo string, version *GoVersion,
138137
if !version.IsTip() {
139138
// write VERSION file
140139
versionFile := filepath.Join(tmp, "VERSION")
141-
err := ioutil.WriteFile(versionFile, []byte(version.String()), 0o644)
140+
err := os.WriteFile(versionFile, []byte(version.String()), 0o644)
142141
if err != nil {
143142
return err
144143
}

util.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package gvm
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/ioutil"
76
"os"
87
"path/filepath"
98
"runtime"
@@ -61,11 +60,11 @@ func writeJSONFile(filename string, value interface{}) error {
6160
if err != nil {
6261
return err
6362
}
64-
return ioutil.WriteFile(filename, contents, 0o644)
63+
return os.WriteFile(filename, contents, 0o644)
6564
}
6665

6766
func readJSONFile(filename string, to interface{}) error {
68-
contents, err := ioutil.ReadFile(filename)
67+
contents, err := os.ReadFile(filename)
6968
if err != nil {
7069
return err
7170
}

0 commit comments

Comments
 (0)