Skip to content

Commit

Permalink
Add Go v1.22.x to CI workflow (#351)
Browse files Browse the repository at this point in the history
Signed-off-by: Janusz Marcinkiewicz <[email protected]>
  • Loading branch information
VirrageS authored Jul 2, 2024
1 parent 6fad7b0 commit 869874d
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x]
go-version: [1.20.x, 1.21.x, 1.22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
linters:
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
Expand All @@ -35,5 +35,5 @@ jobs:
- name: lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.1
version: v1.57.2
args: --print-resources-usage --timeout=10m --verbose
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# NOTE: This Makefile is only necessary if you
# NOTE: This Makefile is only necessary if you
# plan on developing the msgp tool and library.
# Installation can still be performed with a
# normal `go install`.
Expand Down Expand Up @@ -55,8 +55,8 @@ ci: prepare
if [ `arch` == 'x86_64' ]; then \
sudo apt-get -y -q update; \
sudo apt-get -y -q install build-essential; \
wget -q https://github.com/tinygo-org/tinygo/releases/download/v0.30.0/tinygo_0.30.0_amd64.deb; \
sudo dpkg -i tinygo_0.30.0_amd64.deb; \
wget -q https://github.com/tinygo-org/tinygo/releases/download/v0.32.0/tinygo_0.32.0_amd64.deb; \
sudo dpkg -i tinygo_0.32.0_amd64.deb; \
export PATH=$$PATH:/usr/local/tinygo/bin; \
fi
go test -v ./... ./_generated
10 changes: 5 additions & 5 deletions _generated/omitempty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package _generated

import (
"bytes"
"io/ioutil"
"io"
"testing"

"github.com/tinylib/msgp/msgp"
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestOmitEmptyLotsOFields(t *testing.T) {
}

func BenchmarkOmitEmpty10AllEmpty(b *testing.B) {
en := msgp.NewWriter(ioutil.Discard)
en := msgp.NewWriter(io.Discard)
var s OmitEmpty10

b.ResetTimer()
Expand All @@ -160,7 +160,7 @@ func BenchmarkOmitEmpty10AllEmpty(b *testing.B) {
}

func BenchmarkOmitEmpty10AllFull(b *testing.B) {
en := msgp.NewWriter(ioutil.Discard)
en := msgp.NewWriter(io.Discard)
var s OmitEmpty10
s.Field00 = "this is the value of field00"
s.Field01 = "this is the value of field01"
Expand All @@ -184,7 +184,7 @@ func BenchmarkOmitEmpty10AllFull(b *testing.B) {
}

func BenchmarkNotOmitEmpty10AllEmpty(b *testing.B) {
en := msgp.NewWriter(ioutil.Discard)
en := msgp.NewWriter(io.Discard)
var s NotOmitEmpty10

b.ResetTimer()
Expand All @@ -198,7 +198,7 @@ func BenchmarkNotOmitEmpty10AllEmpty(b *testing.B) {
}

func BenchmarkNotOmitEmpty10AllFull(b *testing.B) {
en := msgp.NewWriter(ioutil.Discard)
en := msgp.NewWriter(io.Discard)
var s NotOmitEmpty10
s.Field00 = "this is the value of field00"
s.Field01 = "this is the value of field01"
Expand Down
11 changes: 4 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
module github.com/tinylib/msgp

go 1.18
go 1.20

require (
github.com/philhofer/fwd v1.1.2
golang.org/x/tools v0.14.0
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986
golang.org/x/tools v0.22.0
)

require (
golang.org/x/mod v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
)
require golang.org/x/mod v0.18.0 // indirect
15 changes: 7 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw=
github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986 h1:jYi87L8j62qkXzaYHAQAhEapgukhenIMZRBKTNRLHJ4=
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
15 changes: 5 additions & 10 deletions issue185_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"go/ast"
"go/parser"
"go/token"
"io/ioutil"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -39,15 +38,15 @@ func TestIssue185Idents(t *testing.T) {
for idx, identCase := range identCases {
// generate the code, extract the generated variable names, mapped to function name
var tplData issue185TplData
varsBefore, err := loadVars(identCase.tpl, tplData)
varsBefore, err := loadVars(t, identCase.tpl, tplData)
if err != nil {
t.Fatalf("%d: could not extract before vars: %v", idx, err)
}

// regenerate the code with extra field(s), extract the generated variable
// names, mapped to function name
tplData.Extra = true
varsAfter, err := loadVars(identCase.tpl, tplData)
varsAfter, err := loadVars(t, identCase.tpl, tplData)
if err != nil {
t.Fatalf("%d: could not extract after vars: %v", idx, err)
}
Expand Down Expand Up @@ -102,7 +101,7 @@ func TestIssue185Overlap(t *testing.T) {
for idx, o := range overlapCases {
// regenerate the code with extra field(s), extract the generated variable
// names, mapped to function name
mvars, err := loadVars(o.tpl, o.data)
mvars, err := loadVars(t, o.tpl, o.data)
if err != nil {
t.Fatalf("%d: could not extract after vars: %v", idx, err)
}
Expand Down Expand Up @@ -134,12 +133,8 @@ func TestIssue185Overlap(t *testing.T) {
}
}

func loadVars(tpl *template.Template, tplData interface{}) (vars extractedVars, err error) {
tempDir, err := ioutil.TempDir("", "msgp-")
if err != nil {
err = fmt.Errorf("could not create temp dir: %v", err)
return
}
func loadVars(t *testing.T, tpl *template.Template, tplData interface{}) (vars extractedVars, err error) {
tempDir := t.TempDir()

if !debugTemp {
defer os.RemoveAll(tempDir)
Expand Down
6 changes: 0 additions & 6 deletions msgp/extension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"math/rand"
"testing"
"time"
)

var extSizes = [...]int{0, 1, 2, 4, 8, 16, int(tint8), int(tuint16), int(tuint32)}
Expand All @@ -17,8 +16,6 @@ func randomExt() RawExtension {
}

func TestReadWriteExtension(t *testing.T) {
rand.Seed(time.Now().Unix())

var buf bytes.Buffer
en := NewWriter(&buf)
dc := NewReader(&buf)
Expand Down Expand Up @@ -121,7 +118,6 @@ func TestExtensionRawStackBuffer(t *testing.T) {

func TestReadWriteExtensionBytes(t *testing.T) {
var bts []byte
rand.Seed(time.Now().Unix())

for i := 0; i < 24; i++ {
e := randomExt()
Expand All @@ -134,8 +130,6 @@ func TestReadWriteExtensionBytes(t *testing.T) {
}

func TestAppendAndWriteCompatibility(t *testing.T) {
rand.Seed(time.Now().Unix())

var bts []byte
var buf bytes.Buffer
en := NewWriter(&buf)
Expand Down
4 changes: 2 additions & 2 deletions msgp/file_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package msgp

import (
"io/ioutil"
"io"
"os"
)

Expand All @@ -21,7 +21,7 @@ func ReadFile(dst Unmarshaler, file *os.File) error {
return u.DecodeMsg(NewReader(file))
}

data, err := ioutil.ReadAll(file)
data, err := io.ReadAll(file)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions printer/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"strings"

"github.com/tinylib/msgp/gen"
Expand Down Expand Up @@ -52,7 +52,7 @@ func format(file string, data []byte) error {
if err != nil {
return err
}
return ioutil.WriteFile(file, out, 0o600)
return os.WriteFile(file, out, 0o600)
}

func goformat(file string, data []byte) <-chan error {
Expand Down

0 comments on commit 869874d

Please sign in to comment.