fix(go): Upgrade to Go 1.21
This commit is contained in:
parent
fca254efea
commit
c3588c9e05
|
@ -9,7 +9,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.17]
|
||||
go-version: [1.21]
|
||||
|
||||
steps:
|
||||
- name: Setup Go ${{ matrix.go-version }}
|
||||
|
@ -39,7 +39,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.17]
|
||||
go-version: [1.21]
|
||||
|
||||
steps:
|
||||
- name: Setup Go ${{ matrix.go-version }}
|
||||
|
|
|
@ -2,7 +2,7 @@ package data
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -26,7 +26,7 @@ func TestStatistics(t *testing.T) {
|
|||
}
|
||||
|
||||
func testfile(name string, obj interface{}) {
|
||||
file, err := ioutil.ReadFile("testdata/" + name)
|
||||
file, err := os.ReadFile("testdata/" + name)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package logging
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -27,34 +26,34 @@ func TestStart(t *testing.T) {
|
|||
})
|
||||
assert.NoError(err)
|
||||
|
||||
dat, _ := ioutil.ReadFile(path)
|
||||
dat, _ := os.ReadFile(path)
|
||||
assert.NotContains(string(dat), "InsertNode")
|
||||
|
||||
conn.InsertNode(&runtime.Node{
|
||||
Statistics: &data.Statistics{},
|
||||
})
|
||||
|
||||
dat, _ = ioutil.ReadFile(path)
|
||||
dat, _ = os.ReadFile(path)
|
||||
assert.Contains(string(dat), "InsertNode")
|
||||
|
||||
assert.NotContains(string(dat), "InsertLink")
|
||||
conn.InsertLink(&runtime.Link{}, time.Now())
|
||||
dat, _ = ioutil.ReadFile(path)
|
||||
dat, _ = os.ReadFile(path)
|
||||
assert.Contains(string(dat), "InsertLink")
|
||||
|
||||
assert.NotContains(string(dat), "InsertGlobals")
|
||||
conn.InsertGlobals(&runtime.GlobalStats{}, time.Now(), runtime.GLOBAL_SITE, runtime.GLOBAL_DOMAIN)
|
||||
dat, _ = ioutil.ReadFile(path)
|
||||
dat, _ = os.ReadFile(path)
|
||||
assert.Contains(string(dat), "InsertGlobals")
|
||||
|
||||
assert.NotContains(string(dat), "PruneNodes")
|
||||
conn.PruneNodes(time.Second)
|
||||
dat, _ = ioutil.ReadFile(path)
|
||||
dat, _ = os.ReadFile(path)
|
||||
assert.Contains(string(dat), "PruneNodes")
|
||||
|
||||
assert.NotContains(string(dat), "Close")
|
||||
conn.Close()
|
||||
dat, _ = ioutil.ReadFile(path)
|
||||
dat, _ = os.ReadFile(path)
|
||||
assert.Contains(string(dat), "Close")
|
||||
|
||||
os.Remove(path)
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module github.com/FreifunkBremen/yanic
|
||||
|
||||
go 1.17
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.3.2
|
||||
|
|
15
go.sum
15
go.sum
|
@ -13,6 +13,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
|||
github.com/fgrosse/graphigo v0.0.0-20151222101953-5770fe631d9a h1:vV0pSGlrwV+cPffwHDKckZiU3qcaIXTnZGXLX64i4Rk=
|
||||
github.com/fgrosse/graphigo v0.0.0-20151222101953-5770fe631d9a/go.mod h1:m3fD9iVpJUF8Kl2kz/HwASu4Hf1x3s3V+H0BiEj46XQ=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
|
@ -31,12 +32,15 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf
|
|||
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c h1:qSHzRbhzK8RdXOsAdfDgO49TtqC1oZ+acxPrkfTxcCs=
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
|
||||
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
|
||||
github.com/paulmach/go.geojson v1.5.0 h1:7mhpMK89SQdHFcEGomT7/LuJhwhEgfmpWYVlVmLEdQw=
|
||||
github.com/paulmach/go.geojson v1.5.0/go.mod h1:DgdUy2rRVDDVgKqrjMe2vZAHMfhDTrjVKt3LmHIXGbU=
|
||||
|
@ -52,7 +56,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
|
|||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tidwall/gjson v1.16.0 h1:SyXa+dsSPpUlcwEDuKuEBJEz5vzTvOea+9rjyYodQFg=
|
||||
|
@ -74,6 +77,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
|||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@ -92,6 +97,8 @@ golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
|
|||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
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.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
|
@ -105,13 +112,17 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
|
|||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
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/fgrosse/graphigo.v2 v2.0.0-20151220153422-55a0a92a7030 h1:EFs63oNabMkD6Id8lVrIUAA+61GGtkzxnA4auRoAkwY=
|
||||
gopkg.in/fgrosse/graphigo.v2 v2.0.0-20151220153422-55a0a92a7030/go.mod h1:DXZVkyME6s9B/JGEUvA8aN0ip2fJgEhA72/rvfOeiIA=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
@ -2,7 +2,7 @@ package meshviewer
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -56,7 +56,7 @@ func testGetNodeByFile(filename string) *runtime.Node {
|
|||
}
|
||||
|
||||
func testfile(name string, obj interface{}) {
|
||||
file, err := ioutil.ReadFile("../../runtime/testdata/" + name)
|
||||
file, err := os.ReadFile("../../runtime/testdata/" + name)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package respond
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -34,7 +34,7 @@ func TestParse(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
|
||||
// read testdata
|
||||
compressed, err := ioutil.ReadFile("testdata/nodeinfo.flated")
|
||||
compressed, err := os.ReadFile("testdata/nodeinfo.flated")
|
||||
assert.Nil(err)
|
||||
|
||||
res := &Response{
|
||||
|
@ -53,7 +53,7 @@ func TestParseCustomFields(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
|
||||
// read testdata
|
||||
compressed, err := ioutil.ReadFile("testdata/nodeinfo.flated")
|
||||
compressed, err := os.ReadFile("testdata/nodeinfo.flated")
|
||||
assert.Nil(err)
|
||||
|
||||
res := &Response{
|
||||
|
@ -80,7 +80,7 @@ func TestParseCustomFieldNotExistant(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
|
||||
// read testdata
|
||||
compressed, err := ioutil.ReadFile("testdata/nodeinfo.flated")
|
||||
compressed, err := os.ReadFile("testdata/nodeinfo.flated")
|
||||
assert.Nil(err)
|
||||
|
||||
res := &Response{
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"compress/flate"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
|
||||
"github.com/bdlm/log"
|
||||
|
@ -56,7 +55,7 @@ func (res *Response) parse(customFields []CustomFieldConfig) (*data.ResponseData
|
|||
deflater := flate.NewReader(bytes.NewReader(res.Raw))
|
||||
defer deflater.Close()
|
||||
|
||||
jsonData, err := ioutil.ReadAll(deflater)
|
||||
jsonData, err := io.ReadAll(deflater)
|
||||
if err != nil && err != io.ErrUnexpectedEOF {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package runtime
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -65,7 +64,7 @@ func TestLoadAndSave(t *testing.T) {
|
|||
config.StatePath = "testdata/nodes.json"
|
||||
nodes.load()
|
||||
|
||||
tmpfile, _ := ioutil.TempFile("/tmp", "nodes")
|
||||
tmpfile, _ := os.CreateTemp("/tmp", "nodes")
|
||||
config.StatePath = tmpfile.Name()
|
||||
nodes.save()
|
||||
os.Remove(tmpfile.Name())
|
||||
|
@ -75,7 +74,7 @@ func TestLoadAndSave(t *testing.T) {
|
|||
// "open /proc/a.tmp: permission denied",
|
||||
})
|
||||
|
||||
tmpfile, _ = ioutil.TempFile("/tmp", "nodes")
|
||||
tmpfile, _ = os.CreateTemp("/tmp", "nodes")
|
||||
assert.Panics(func() {
|
||||
SaveJSON(tmpfile.Name, tmpfile.Name())
|
||||
// "json: unsupported type: func() string",
|
||||
|
|
Loading…
Reference in New Issue