Skip to content

Commit

Permalink
Upgrade to Go 1.20.3
Browse files Browse the repository at this point in the history
  • Loading branch information
britannic committed Apr 9, 2023
1 parent 95b522a commit 12d4fcc
Show file tree
Hide file tree
Showing 17 changed files with 157 additions and 155 deletions.
263 changes: 128 additions & 135 deletions doc.go

Large diffs are not rendered by default.

Binary file added edgeos-dnsmasq-blacklist_1.2.4.8_mips.deb
Binary file not shown.
Binary file added edgeos-dnsmasq-blacklist_1.2.4.8_mipsel.deb
Binary file not shown.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/smartystreets/goconvey v1.7.2
golang.org/x/sync v0.1.0
golang.org/x/term v0.7.0
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384
)

require (
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
3 changes: 1 addition & 2 deletions internal/dnsmasq/dnsmasq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"path/filepath"
"testing"

Expand All @@ -32,7 +31,7 @@ func TestConfigFile(t *testing.T) {
Printf("cannot open configuration file %s!", f)
}

b, _ = ioutil.ReadAll(r)
b, _ = io.ReadAll(r)
c := make(Conf)
ip := "0.0.0.0"
So(c.Parse(&Mapping{Contents: b}), ShouldBeNil)
Expand Down
2 changes: 1 addition & 1 deletion internal/edgeos/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func TestReadCfg(t *testing.T) {
Printf("cannot open configuration file %s!", f)
}

b, _ = ioutil.ReadAll(r)
b, _ = io.ReadAll(r)

Convey("Testing with a configuration loaded from a file", func() {
act := NewConfig().Blacklist(&CFGstatic{Cfg: string(b)})
Expand Down
4 changes: 2 additions & 2 deletions internal/edgeos/content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (d *dummyConfig) ProcessContent(cts ...Contenter) error {
src.ctr.Lock()
src.ctr.stat[area] = tally
src.ctr.Unlock()
b, _ := ioutil.ReadAll(src.process().r)
b, _ := io.ReadAll(src.process().r)
d.s = append(d.s, strings.TrimSuffix(string(b), "\n"))
}
}
Expand Down Expand Up @@ -902,7 +902,7 @@ address=/really.bad.phishing.site.ru/10.10.10.10
reader, err := GetFile(tt.f)
So(err, ShouldBeNil)

act, err := ioutil.ReadAll(reader)
act, err := io.ReadAll(reader)
So(err, ShouldBeNil)

Convey("Testing "+tt.name+" ProcessContent(): file data should match expected", func() {
Expand Down
3 changes: 2 additions & 1 deletion internal/edgeos/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
// ntype for labeling blacklist source types
type ntype int

//go:generate go run golang.org/x/tools/cmd/stringer -type=ntype
// ntype label blacklist source types
//
//go:generate go run golang.org/x/tools/cmd/stringer -type=ntype
const (
unknown ntype = iota // denotes a coding error
domn // Format type e.g. address=/d.com/0.0.0.0
Expand Down
3 changes: 1 addition & 2 deletions internal/edgeos/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"math/rand"
"sort"
"strings"
Expand Down Expand Up @@ -91,7 +90,7 @@ func TestFormatData(t *testing.T) {

sort.Strings(lines)
expBytes = []byte(strings.Join(lines, ""))
actBytes, err := ioutil.ReadAll(formatData(fmttr, actList))
actBytes, err := io.ReadAll(formatData(fmttr, actList))

So(err, ShouldBeNil)
So(actBytes, ShouldResemble, expBytes)
Expand Down
4 changes: 2 additions & 2 deletions internal/edgeos/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package edgeos
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"net/http"
)

Expand Down Expand Up @@ -33,7 +33,7 @@ func download(s *source) *source {
return s
}

body, err = ioutil.ReadAll(resp.Body)
body, err = io.ReadAll(resp.Body)

if len(body) < 1 {
str := fmt.Sprintf("No data returned for %s", s.url)
Expand Down
6 changes: 3 additions & 3 deletions internal/edgeos/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package edgeos

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"net/url"
Expand Down Expand Up @@ -70,7 +70,7 @@ func TestGetHTTP(t *testing.T) {
fmt.Printf("Test: %v, error: %v\n", i, o.err)
}

act, err := ioutil.ReadAll(o.r)
act, err := io.ReadAll(o.r)
So(err, ShouldBeNil)

So(string(act), ShouldEqual, tt.exp)
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestMyHandler(t *testing.T) {
So(resp.StatusCode, ShouldEqual, 200)

exp := fmt.Sprintf("Visitor count: %d.", i)
act, err := ioutil.ReadAll(resp.Body)
act, err := io.ReadAll(resp.Body)
So(err, ShouldBeNil)
So(string(act), ShouldEqual, exp)
}
Expand Down
3 changes: 2 additions & 1 deletion internal/edgeos/io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package edgeos

import (
"fmt"
"io"
"io/ioutil"
"os"
"testing"
Expand All @@ -24,7 +25,7 @@ func TestLoad(t *testing.T) {
So(err, ShouldNotBeNil)

r := CFGcli{Config: c}
act, err := ioutil.ReadAll(r.read())
act, err := io.ReadAll(r.read())
So(err, ShouldBeNil)
So(string(act), ShouldEqual, "")

Expand Down
8 changes: 8 additions & 0 deletions internal/edgeos/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build tools
// +build tools

package edgeos

import (
_ "golang.org/x/tools/cmd/stringer"
)
3 changes: 2 additions & 1 deletion internal/regx/regx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
// Leaf is a config label
type Leaf int

//ggo:generate go run golang.org/x/tools/cmd/stringer -type=Leaf
// Leaf label regx map keys
//
//ggo:generate go run golang.org/x/tools/cmd/stringer -type=Leaf
const (
CMNT Leaf = iota + 1000
DESC
Expand Down
5 changes: 2 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -35,7 +34,7 @@ var update = flag.Bool("update", false, "update .golden files")

func readGolden(t *testing.T, name string) []byte {
path := filepath.Join("testdata", name+".golden") // relative path
bytes, err := ioutil.ReadFile(path)
bytes, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
Expand All @@ -45,7 +44,7 @@ func readGolden(t *testing.T, name string) []byte {
func writeGolden(t *testing.T, actual []byte, name string) error {
golden := filepath.Join("testdata", name+".golden")
if *update {
return ioutil.WriteFile(golden, actual, 0o644)
return os.WriteFile(golden, actual, 0o644)
}
return nil
}
Expand Down
3 changes: 1 addition & 2 deletions opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"os"
"runtime"
"strings"
Expand Down Expand Up @@ -59,7 +58,7 @@ func (o *opts) getCFG(c *e.Config) e.ConfLoader {
logFatalf("cannot open configuration file %s!", *o.File)
}

if f, err = ioutil.ReadAll(r); err != nil {
if f, err = io.ReadAll(r); err != nil {
logFatalf("cannot read configuration file %s!", *o.File)
}
return &e.CFGstatic{Config: c, Cfg: string(f)}
Expand Down

0 comments on commit 12d4fcc

Please sign in to comment.