Skip to content

Commit

Permalink
Revert "Bump Golang to 1.23.1" (vmware-tanzu#883)
Browse files Browse the repository at this point in the history
This reverts commit 1e37a60
  • Loading branch information
yuntanghsu authored Nov 12, 2024
1 parent 38be213 commit 9da8637
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.23.1
go-version: 1.21

- name: Run golangci-lint
run: make golangci
Expand Down
12 changes: 4 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
run:
tests: true
timeout: 15m
issues:
exclude-files:
- third_party/
- pkg/client/
skip-files:
- third_party/
- pkg/client/
skip-dirs-use-default: true

linters-settings:
Expand All @@ -22,9 +21,6 @@ linters-settings:
- name: superfluous-else
- name: var-declaration
- name: duplicated-imports
gosec:
excludes:
- G115

linters:
disable-all: true
Expand All @@ -35,7 +31,7 @@ linters:
- staticcheck
- gosec
- goimports
- govet
- vet
- revive

issues:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GOFLAGS :=
BINDIR ?= $(CURDIR)/bin
GO_FILES := $(shell find . -type d -name '.cache' -prune -o -type f -name '*.go' -print)

GOLANGCI_LINT_VERSION := v1.61.0
GOLANGCI_LINT_VERSION := v1.54.0
GOLANGCI_LINT_BINDIR := $(CURDIR)/.golangci-bin
GOLANGCI_LINT_BIN := $(GOLANGCI_LINT_BINDIR)/$(GOLANGCI_LINT_VERSION)/golangci-lint

Expand Down
2 changes: 1 addition & 1 deletion build/image/photon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23.1 as golang-build
FROM golang:1.22.7 as golang-build

WORKDIR /source

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vmware-tanzu/nsx-operator

go 1.23.1
go 1.22.5

replace (
github.com/vmware-tanzu/nsx-operator/pkg/apis => ./pkg/apis
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vmware-tanzu/nsx-operator/pkg/apis

go 1.23.1
go 1.21

require (
k8s.io/api v0.26.1
Expand Down
3 changes: 1 addition & 2 deletions pkg/client/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vmware-tanzu/nsx-operator/pkg/client

go 1.23.1
go 1.22.5

require (
github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20240813023528-cb525458c6ee
Expand All @@ -19,7 +19,6 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ func parseCIDRRange(cidr string) (startIP, endIP net.IP, err error) {
func calculateOffsetIP(ip net.IP, offset int) (net.IP, error) {
ipInt := ipToUint32(ip)
ipInt += uint32(offset)
if int(ipInt) < 0 {
return nil, fmt.Errorf("resulting IP is less than 0")
}
if ipInt > 0xFFFFFFFF {
return nil, fmt.Errorf("resulting IP is greater than 255.255.255.255")
}
return uint32ToIP(ipInt), nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/util/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestUtil_IsNsInSystemNamespace(t *testing.T) {

isCRInSysNs, err := IsSystemNamespace(client, ns.Namespace, nil)
if err != nil {
t.Fatalf("%s", err.Error())
t.Fatalf(err.Error())
}
if isCRInSysNs {
t.Fatalf("Non-system namespace identied as a system namespace")
Expand All @@ -103,7 +103,7 @@ func TestUtil_IsNsInSystemNamespace(t *testing.T) {

isCRInSysNs, err = IsSystemNamespace(client, ns.Namespace, nil)
if err != nil {
t.Fatalf("%s", err.Error())
t.Fatalf(err.Error())
}
if !isCRInSysNs {
t.Fatalf("System namespace not identied as a system namespace")
Expand Down

0 comments on commit 9da8637

Please sign in to comment.