From 6d6c4089575dfbd1619623c442de4419b3445430 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 26 Feb 2023 21:31:20 +0000 Subject: [PATCH 1/3] Test against Go 1.20, maybe fix lint issue --- .github/workflows/ci.yml | 8 ++++---- src/tun/tun.go | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c99ac06..77475403 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: strategy: fail-fast: false matrix: - goversion: ["1.17", "1.18", "1.19"] + goversion: ["1.17", "1.18", "1.19", "1.20"] name: Build & Test (Linux, Go ${{ matrix.goversion }}) needs: [lint] @@ -75,7 +75,7 @@ jobs: strategy: fail-fast: false matrix: - goversion: ["1.17", "1.18", "1.19"] + goversion: ["1.17", "1.18", "1.19", "1.20"] name: Build & Test (Windows, Go ${{ matrix.goversion }}) needs: [lint] @@ -99,7 +99,7 @@ jobs: strategy: fail-fast: false matrix: - goversion: ["1.17", "1.18", "1.19"] + goversion: ["1.17", "1.18", "1.19", "1.20"] name: Build & Test (macOS, Go ${{ matrix.goversion }}) needs: [lint] @@ -128,4 +128,4 @@ jobs: - name: Check all tests passed uses: re-actors/alls-green@release/v1 with: - jobs: ${{ toJSON(needs) }} \ No newline at end of file + jobs: ${{ toJSON(needs) }} diff --git a/src/tun/tun.go b/src/tun/tun.go index ce1bd169..9ec7bc90 100644 --- a/src/tun/tun.go +++ b/src/tun/tun.go @@ -107,7 +107,8 @@ func (tun *TunAdapter) _start() error { } tun.addr = tun.rwc.Address() tun.subnet = tun.rwc.Subnet() - addr := fmt.Sprintf("%s/%d", net.IP(tun.addr[:]).String(), 8*len(address.GetPrefix())-1) + prefix := address.GetPrefix() + addr := fmt.Sprintf("%s/%d", net.IP(tun.addr[:]).String(), 8*len(prefix)-1) if tun.config.name == "none" || tun.config.name == "dummy" { tun.log.Debugln("Not starting TUN as ifname is none or dummy") tun.isEnabled = false From 1dd1d0ab8c55bba222f4ef678011b97a0382316e Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 26 Feb 2023 21:32:26 +0000 Subject: [PATCH 2/3] Build packages with Go 1.20 --- .github/workflows/pkg.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pkg.yml b/.github/workflows/pkg.yml index f282cc21..dd43fce8 100644 --- a/.github/workflows/pkg.yml +++ b/.github/workflows/pkg.yml @@ -25,7 +25,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: "1.20" - name: Build package env: @@ -56,7 +56,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: "1.20" - name: Build package env: @@ -87,7 +87,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: "1.20" - name: Build package run: sh contrib/msi/build-msi.sh ${{ matrix.pkgarch }} @@ -122,7 +122,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: "1.20" - name: Build package env: From 38736358dda588e30cbce931f7f41fdf26f5d5f0 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 26 Feb 2023 21:35:56 +0000 Subject: [PATCH 3/3] Fix lint error properly this time --- src/tun/tun.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tun/tun.go b/src/tun/tun.go index 9ec7bc90..fcd597b8 100644 --- a/src/tun/tun.go +++ b/src/tun/tun.go @@ -108,7 +108,7 @@ func (tun *TunAdapter) _start() error { tun.addr = tun.rwc.Address() tun.subnet = tun.rwc.Subnet() prefix := address.GetPrefix() - addr := fmt.Sprintf("%s/%d", net.IP(tun.addr[:]).String(), 8*len(prefix)-1) + addr := fmt.Sprintf("%s/%d", net.IP(tun.addr[:]).String(), 8*len(prefix[:])-1) if tun.config.name == "none" || tun.config.name == "dummy" { tun.log.Debugln("Not starting TUN as ifname is none or dummy") tun.isEnabled = false