Skip to content

Commit

Permalink
Bump deps and Go versions (#63)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewkroh committed Aug 10, 2023
1 parent a2346ae commit 46b74d3
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 58 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
strategy:
matrix:
go-version:
- 1.18
- 1.19
- '1.20'
- '1.21'
steps:
- uses: actions/checkout@v3

- name: set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -39,43 +39,43 @@ jobs:
strategy:
matrix:
go-version:
- 1.18
- 1.19
- '1.20'
- '1.21'
steps:
- uses: actions/checkout@v3

- name: set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: go test
run: go test ./...

test-macos:
name: Go Test (macOS 12) (1.18)
name: Go Test (macOS 12) (1.20)
runs-on: macos-12
steps:
- uses: actions/checkout@v3

- name: set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: '1.20'

- name: go test
run: go test ./...

test-windows:
name: Go Test (Windows) (1.18)
name: Go Test (Windows) (1.20)
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: '1.20'

- name: go test
run: go test ./...
run: go test -timeout 15m ./...
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: '1.20'

- uses: actions/checkout@v3

Expand All @@ -31,4 +31,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.47.0
version: v1.54.0
4 changes: 2 additions & 2 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.20'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ linters:
- typecheck
- unused
- varcheck
- depguard
- errorlint
- gofumpt
- goimports
Expand Down
3 changes: 1 addition & 2 deletions binrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package gvm
import (
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand All @@ -17,7 +16,7 @@ var reGostoreVersion = regexp.MustCompile(`go(.*)\.(.*)-(.*)\..*`)
func (m *Manager) installBinary(version *GoVersion) (string, error) {
godir := m.versionDir(version)

tmp, err := ioutil.TempDir("", godir)
tmp, err := os.MkdirTemp("", godir)
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/gvm/gvm.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"io/ioutil"
"io"
"os"
"runtime"
"runtime/debug"
Expand Down Expand Up @@ -95,7 +95,7 @@ func main() {
if *debug {
logrus.SetOutput(os.Stderr)
} else {
logrus.SetOutput(ioutil.Discard)
logrus.SetOutput(io.Discard)
}
return nil
})
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module github.com/andrewkroh/gvm

go 1.17
go 1.20

require (
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
github.com/hashicorp/go-version v1.2.0
github.com/otiai10/copy v1.2.0
github.com/sirupsen/logrus v1.4.2
github.com/stretchr/testify v1.3.0
github.com/hashicorp/go-version v1.6.0
github.com/otiai10/copy v1.12.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.7.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 // indirect
golang.org/x/sys v0.11.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
36 changes: 16 additions & 20 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,24 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k=
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc=
github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY=
github.com/otiai10/copy v1.12.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww=
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 h1:A9i04dxx7Cribqbs8jf3FQLogkL/CV2YN7hj9KWJCkc=
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
3 changes: 1 addition & 2 deletions gvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package gvm
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -192,7 +191,7 @@ func (m *Manager) Remove(version *GoVersion) error {

// Installed returns all installed go version
func (m *Manager) Installed() ([]*GoVersion, error) {
files, err := ioutil.ReadDir(m.versionsDir)
files, err := os.ReadDir(m.versionsDir)
if err != nil {
return nil, err
}
Expand Down
5 changes: 2 additions & 3 deletions srcrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package gvm
import (
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -90,7 +89,7 @@ func (m *Manager) installSrc(version *GoVersion) (string, error) {
godir := m.versionDir(version)

log.Println("create temp directory")
tmpRoot, err := ioutil.TempDir("", godir)
tmpRoot, err := os.MkdirTemp("", godir)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -138,7 +137,7 @@ func buildGo(log logrus.FieldLogger, buildDir, repo string, version *GoVersion,
if !version.IsTip() {
// write VERSION file
versionFile := filepath.Join(tmp, "VERSION")
err := ioutil.WriteFile(versionFile, []byte(version.String()), 0o644)
err := os.WriteFile(versionFile, []byte(version.String()), 0o644)
if err != nil {
return err
}
Expand Down
5 changes: 2 additions & 3 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package gvm
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -61,11 +60,11 @@ func writeJSONFile(filename string, value interface{}) error {
if err != nil {
return err
}
return ioutil.WriteFile(filename, contents, 0o644)
return os.WriteFile(filename, contents, 0o644)
}

func readJSONFile(filename string, to interface{}) error {
contents, err := ioutil.ReadFile(filename)
contents, err := os.ReadFile(filename)
if err != nil {
return err
}
Expand Down

0 comments on commit 46b74d3

Please sign in to comment.