Skip to content

Commit

Permalink
bump golang version to 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
aleoli authored and adamjensenbot committed Feb 22, 2023
1 parent 6913206 commit 69d3f30
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-generated-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.20'

- name: Run the automatic generation
working-directory: ./
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.20'
env:
GOPATH: ${{ github.workspace }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.20'

- name: golangci-lint
uses: golangci/[email protected]
with:
only-new-issues: true
version: v1.50.0
version: v1.51.2
args: --timeout=900s

gomodtidy:
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: '1.20'

- name: Execute go mod tidy and check the outcome
working-directory: ./
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fmt: gci addlicense
# Install golangci-lint if not available
golangci-lint:
ifeq (, $(shell which golangci-lint))
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.0
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
GOLANGCILINT=$(GOBIN)/golangci-lint
else
GOLANGCILINT=$(shell which golangci-lint)
Expand Down
2 changes: 1 addition & 1 deletion build/common/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 as builder
FROM golang:1.20 as builder
WORKDIR /tmp/builder

COPY go.mod ./go.mod
Expand Down
2 changes: 1 addition & 1 deletion build/liqo-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 as builder
FROM golang:1.20 as builder
ENV PATH /go/bin:/usr/local/go/bin:$PATH
ENV GOPATH /go
ENV K8S_VERSION=1.25.0
Expand Down
2 changes: 1 addition & 1 deletion build/liqonet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG VERSION=0.5.2
RUN cargo install --version $VERSION boringtun-cli


FROM golang:1.19 as goBuilder
FROM golang:1.20 as goBuilder
WORKDIR /tmp/builder

COPY go.mod ./go.mod
Expand Down
9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/liqotech/liqo

go 1.19
go 1.20

require (
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible
Expand Down Expand Up @@ -33,6 +33,8 @@ require (
github.com/virtual-kubelet/virtual-kubelet v1.6.1-0.20220831210300-d2523fe808a2
github.com/vishvananda/netlink v1.2.1-beta.2
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74
go4.org/netipx v0.0.0-20220925034521-797b0c90d8ab
golang.org/x/exp v0.0.0-20221114191408-850992195362
golang.org/x/mod v0.8.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.5.0
Expand All @@ -44,7 +46,6 @@ require (
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v3 v3.0.1
helm.sh/helm/v3 v3.11.1
inet.af/netaddr v0.0.0-20220811202034-502d2d690317
k8s.io/api v0.26.1
k8s.io/apiextensions-apiserver v0.26.1
k8s.io/apimachinery v0.26.1
Expand Down Expand Up @@ -228,11 +229,7 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go4.org/intern v0.0.0-20220617035311-6925f38cc365 // indirect
go4.org/netipx v0.0.0-20220925034521-797b0c90d8ab // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/exp v0.0.0-20221114191408-850992195362
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/term v0.5.0 // indirect
Expand Down
9 changes: 0 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arX
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dvyukov/go-fuzz v0.0.0-20210103155950-6a8e9d1f2415/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/elazarl/goproxy v0.0.0-20190911111923-ecfe977594f1 h1:yY9rWGoXv1U5pl4gxqlULARMQD7x0QG85lqEXTWysik=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
Expand Down Expand Up @@ -1021,14 +1020,8 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
go4.org/intern v0.0.0-20211027215823-ae77deb06f29/go.mod h1:cS2ma+47FKrLPdXFpr7CuxiTW3eyJbWew4qx0qtQWDA=
go4.org/intern v0.0.0-20220617035311-6925f38cc365 h1:t9hFvR102YlOqU0fQn1wgwhNvSbHGBbbJxX9JKfU3l0=
go4.org/intern v0.0.0-20220617035311-6925f38cc365/go.mod h1:WXRv3p7T6gzt0CcJm43AAKdKVZmcQbwwC7EwquU5BZU=
go4.org/netipx v0.0.0-20220925034521-797b0c90d8ab h1:+yW1yrZ09EYNu1spCUOHBBNRbrLnfmutwyhbhCv3b6Q=
go4.org/netipx v0.0.0-20220925034521-797b0c90d8ab/go.mod h1:tgPU4N2u9RByaTN3NC2p9xOzyFpte4jYwsIIRF7XlSc=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 h1:FyBZqvoA/jbNzuAWLQE2kG820zMAkcilx6BMjGbL/E4=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down Expand Up @@ -1544,8 +1537,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
inet.af/netaddr v0.0.0-20220811202034-502d2d690317 h1:U2fwK6P2EqmopP/hFLTOAjWTki0qgd4GMJn5X8wOleU=
inet.af/netaddr v0.0.0-20220811202034-502d2d690317/go.mod h1:OIezDfdzOgFhuw4HuWapWq2e9l0H9tK4F1j+ETRtF3k=
k8s.io/api v0.19.1/go.mod h1:+u/k4/K/7vp4vsfdT7dyl8Oxk1F26Md4g5F26Tu85PU=
k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s=
k8s.io/api v0.22.1/go.mod h1:bh13rkTp3F1XEaLGykbyRD2QaTTzPm0e/BMd8ptFONY=
Expand Down
17 changes: 9 additions & 8 deletions pkg/liqonet/ipam/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ import (
"errors"
"fmt"
"net"
"net/netip"
"strings"
"sync"

goipam "github.com/metal-stack/go-ipam"
"go4.org/netipx"
grpc "google.golang.org/grpc"
"inet.af/netaddr"
"k8s.io/client-go/dynamic"
"k8s.io/klog/v2"

Expand Down Expand Up @@ -329,24 +330,24 @@ func (liqoIPAM *IPAM) isAcquired(network string) bool {

// Function that receives a network as parameter and returns the pool to which this network belongs to.
func (liqoIPAM *IPAM) getPoolFromNetwork(network string) (networkPool string, success bool, err error) {
var poolIPset netaddr.IPSetBuilder
var c netaddr.IPPrefix
var poolIPset netipx.IPSetBuilder
var c netip.Prefix
// Get resource
pools := liqoIPAM.ipamStorage.getPools()
// Build IPSet for new network
ipprefix, err := netaddr.ParseIPPrefix(network)
ipprefix, err := netip.ParsePrefix(network)
if err != nil {
return
}
for _, pool := range pools {
// Build IPSet for pool
c, err = netaddr.ParseIPPrefix(pool)
c, err = netip.ParsePrefix(pool)
if err != nil {
return
}
poolIPset.AddPrefix(c)
// Check if the pool contains network
var ipSet *netaddr.IPSet
var ipSet *netipx.IPSet
ipSet, err = poolIPset.IPSet()
if err != nil {
return
Expand Down Expand Up @@ -979,11 +980,11 @@ func (liqoIPAM *IPAM) GetExternalCIDR(mask uint8) (string, error) {
// the IP address does belong to the network.
func ipBelongsToNetwork(ip, network string) (bool, error) {
// Parse network
p, err := netaddr.ParseIPPrefix(network)
p, err := netip.ParsePrefix(network)
if err != nil {
return false, fmt.Errorf("cannot parse network: %w", err)
}
return p.Contains(netaddr.MustParseIP(ip)), nil
return p.Contains(netip.MustParseAddr(ip)), nil
}

func (liqoIPAM *IPAM) belongsToPodCIDRInternal(ip string) (bool, error) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/liqonet/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"syscall"
"time"

"inet.af/netaddr"
"go4.org/netipx"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down Expand Up @@ -116,12 +116,12 @@ func SetMask(network string, mask uint8) string {

// Next used to get the second half of a given network.
func Next(network string) string {
prefix, err := netaddr.ParseIPPrefix(network)
prefix, err := netip.ParsePrefix(network)
utilruntime.Must(err)
// Step 1: Get last IP address of network
// Step 2: Get next IP address
firstIP := prefix.Range().To().Next()
prefix = netaddr.IPPrefixFrom(firstIP, prefix.Bits())
firstIP := netipx.RangeOfPrefix(prefix).To().Next()
prefix = netip.PrefixFrom(firstIP, prefix.Bits())
return prefix.String()
}

Expand Down

0 comments on commit 69d3f30

Please sign in to comment.