Update go version (#603)

Removed ioctl code and remove exception from lint action
This commit is contained in:
Maycon Santos 2022-12-04 13:22:21 +01:00 committed by GitHub
parent d029136d3d
commit d2d5d4b4b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 22 additions and 30 deletions

View File

@ -13,7 +13,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: 1.19.x
- name: Checkout code
uses: actions/checkout@v2

View File

@ -16,7 +16,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: 1.19.x
- name: Cache Go modules
@ -45,7 +45,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: 1.19.x
- name: Cache Go modules

View File

@ -31,7 +31,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: 1.19.x
- uses: actions/cache@v2
with:

View File

@ -9,13 +9,10 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: 1.19.x
- name: Install dependencies
run: sudo apt update && sudo apt install -y -q libgtk-3-dev libappindicator3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# SA1019: "io/ioutil" has been deprecated since Go 1.16
args: --timeout=6m -e SA1019
args: --timeout=6m

View File

@ -29,7 +29,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
-
name: Cache Go modules
uses: actions/cache@v1
@ -88,7 +88,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
- name: Cache Go modules
uses: actions/cache@v1
with:
@ -138,7 +138,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
-
name: Cache Go modules
uses: actions/cache@v1

View File

@ -19,7 +19,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: 1.19.x
- name: Cache Go modules
uses: actions/cache@v2

View File

@ -6,7 +6,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"os"
"os/signal"
"path"
@ -236,7 +235,7 @@ func copySymLink(source, dest string) error {
func cpDir(src string, dst string) error {
var err error
var fds []os.FileInfo
var fds []os.DirEntry
var srcinfo os.FileInfo
if srcinfo, err = os.Stat(src); err != nil {
@ -247,7 +246,7 @@ func cpDir(src string, dst string) error {
return err
}
if fds, err = ioutil.ReadDir(src); err != nil {
if fds, err = os.ReadDir(src); err != nil {
return err
}
for _, fd := range fds {

View File

@ -18,7 +18,6 @@ func (unimplementedFirewall) RemoveRoutingRules(pair routerPair) error {
}
func (unimplementedFirewall) CleanRoutingRules() {
return
}
// NewFirewall returns an unimplemented Firewall manager

View File

@ -2,9 +2,9 @@ package routemanager
import (
"github.com/vishvananda/netlink"
"io/ioutil"
"net"
"net/netip"
"os"
)
const ipv4ForwardingPath = "/proc/sys/net/ipv4/ip_forward"
@ -59,12 +59,12 @@ func removeFromRouteTable(prefix netip.Prefix) error {
}
func enableIPForwarding() error {
err := ioutil.WriteFile(ipv4ForwardingPath, []byte("1"), 0644)
err := os.WriteFile(ipv4ForwardingPath, []byte("1"), 0644)
return err
}
func isNetForwardHistoryEnabled() bool {
out, err := ioutil.ReadFile(ipv4ForwardingPath)
out, err := os.ReadFile(ipv4ForwardingPath)
if err != nil {
// todo
panic(err)

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/netbirdio/netbird
go 1.18
go 1.19
require (
github.com/cenkalti/backoff/v4 v4.1.3

View File

@ -8,8 +8,8 @@ import (
log "github.com/sirupsen/logrus"
"github.com/vishvananda/netlink"
"golang.org/x/sys/unix"
"io"
"io/fs"
"io/ioutil"
"math"
"os"
"path/filepath"
@ -295,7 +295,7 @@ func loadModule(name, path string) error {
// first try finit_module(2), then init_module(2)
err = unix.FinitModule(int(f.Fd()), "", 0)
if errors.Is(err, unix.ENOSYS) {
buf, err := ioutil.ReadAll(f)
buf, err := io.ReadAll(f)
if err != nil {
return err
}

View File

@ -6,7 +6,6 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/sys/unix"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -133,7 +132,7 @@ func resetGlobals() {
func createFiles(t *testing.T) (string, []module) {
writeFile := func(path, text string) {
if err := ioutil.WriteFile(path, []byte(text), 0644); err != nil {
if err := os.WriteFile(path, []byte(text), 0644); err != nil {
t.Fatal(err)
}
}

View File

@ -7,7 +7,6 @@ import (
"golang.org/x/crypto/acme/autocert"
"io"
"io/fs"
"io/ioutil"
"net"
"net/http"
"os"
@ -231,7 +230,7 @@ func copySymLink(source, dest string) error {
func cpDir(src string, dst string) error {
var err error
var fds []os.FileInfo
var fds []os.DirEntry
var srcinfo os.FileInfo
if srcinfo, err = os.Stat(src); err != nil {
@ -242,7 +241,7 @@ func cpDir(src string, dst string) error {
return err
}
if fds, err = ioutil.ReadDir(src); err != nil {
if fds, err = os.ReadDir(src); err != nil {
return err
}
for _, fd := range fds {

View File

@ -7,7 +7,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"io"
"io/ioutil"
"os"
)
@ -25,7 +24,7 @@ var _ = Describe("Client", func() {
BeforeEach(func() {
var err error
tmpDir, err = ioutil.TempDir("", "wiretrustee_util_test_tmp_*")
tmpDir, err = os.MkdirTemp("", "wiretrustee_util_test_tmp_*")
Expect(err).NotTo(HaveOccurred())
})