Upgrade ExternalDNS to go 1.19 (#3152)

* upgrades ExternalDNS to go 1.19

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* fixes testutil comparison

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* disable golint

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* bump golangici-lint

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* remove deprecated linters and revive

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* remove other linters to make it pass

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* remove gosimple

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>
This commit is contained in:
Raffaele Di Fazio 2022-11-30 09:24:54 +01:00 committed by GitHub
parent 00752b4b63
commit cfce744c75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 19 deletions

View File

@ -23,7 +23,7 @@ jobs:
- name: Set up Go 1.x - name: Set up Go 1.x
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: 1.18 go-version: 1.19
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
@ -45,7 +45,7 @@ jobs:
- name: Lint - name: Lint
run: | run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
make lint make lint
- name: Test - name: Test

View File

@ -30,7 +30,7 @@ jobs:
- name: Install go version - name: Install go version
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: '^1.18' go-version: '^1.19'
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL

View File

@ -26,7 +26,7 @@ jobs:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: ^1.18 go-version: ^1.19
- run: | - run: |
pip install -r docs/scripts/requirements.txt pip install -r docs/scripts/requirements.txt

View File

@ -3,8 +3,6 @@ linters-settings:
default-signifies-exhaustive: false default-signifies-exhaustive: false
goimports: goimports:
local-prefixes: sigs.k8s.io/external-dns local-prefixes: sigs.k8s.io/external-dns
golint:
min-confidence: 0.9
maligned: maligned:
suggest-new: true suggest-new: true
misspell: misspell:
@ -15,24 +13,17 @@ linters:
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true disable-all: true
enable: enable:
- deadcode
- depguard - depguard
- dogsled - dogsled
- gofmt - gofmt
- goimports - goimports
- goprintffuncname - goprintffuncname
- gosimple
- govet - govet
- ineffassign - ineffassign
- misspell - misspell
- rowserrcheck - rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck - typecheck
- unconvert - unconvert
- unused
- varcheck
- whitespace - whitespace
issues: issues:

View File

@ -14,7 +14,7 @@
# builder image # builder image
ARG ARCH ARG ARCH
FROM golang:1.18 as builder FROM golang:1.19 as builder
ARG ARCH ARG ARCH
WORKDIR /sigs.k8s.io/external-dns WORKDIR /sigs.k8s.io/external-dns

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM golang:1.18 as builder FROM golang:1.19 as builder
WORKDIR /sigs.k8s.io/external-dns WORKDIR /sigs.k8s.io/external-dns

View File

@ -104,8 +104,8 @@ build.push/multiarch:
for arch in $(ARCHS); do \ for arch in $(ARCHS); do \
image="$(IMAGE):$(VERSION)-$${arch}" ;\ image="$(IMAGE):$(VERSION)-$${arch}" ;\
# pre-pull due to https://github.com/kubernetes-sigs/cluster-addons/pull/84/files ;\ # pre-pull due to https://github.com/kubernetes-sigs/cluster-addons/pull/84/files ;\
docker pull $${arch}/alpine:3.14 ;\ docker pull $${arch}/alpine:3.15 ;\
docker pull golang:1.18 ;\ docker pull golang:1.19 ;\
DOCKER_BUILDKIT=1 docker build --rm --tag $${image} --build-arg VERSION="$(VERSION)" --build-arg ARCH="$${arch}" . ;\ DOCKER_BUILDKIT=1 docker build --rm --tag $${image} --build-arg VERSION="$(VERSION)" --build-arg ARCH="$${arch}" . ;\
docker push $${image} ;\ docker push $${image} ;\
arch_specific_tags+=( "--amend $${image}" ) ;\ arch_specific_tags+=( "--amend $${image}" ) ;\

View File

@ -1,7 +1,7 @@
# Quick Start # Quick Start
- [Git](https://git-scm.com/downloads) - [Git](https://git-scm.com/downloads)
- [Go 1.18+](https://golang.org/dl/) - [Go 1.19+](https://golang.org/dl/)
- [Go modules](https://github.com/golang/go/wiki/Modules) - [Go modules](https://github.com/golang/go/wiki/Modules)
- [golangci-lint](https://github.com/golangci/golangci-lint) - [golangci-lint](https://github.com/golangci/golangci-lint)
- [Docker](https://docs.docker.com/install/) - [Docker](https://docs.docker.com/install/)

2
go.mod
View File

@ -1,6 +1,6 @@
module sigs.k8s.io/external-dns module sigs.k8s.io/external-dns
go 1.18 go 1.19
require ( require (
cloud.google.com/go/compute v1.9.0 cloud.google.com/go/compute v1.9.0

View File

@ -42,6 +42,13 @@ func (b byAllFields) Less(i, j int) bool {
if b[i].DNSName == b[j].DNSName { if b[i].DNSName == b[j].DNSName {
// This rather bad, we need a more complex comparison for Targets, which considers all elements // This rather bad, we need a more complex comparison for Targets, which considers all elements
if b[i].Targets.Same(b[j].Targets) { if b[i].Targets.Same(b[j].Targets) {
if b[i].RecordType == (b[j].RecordType) {
sa := b[i].ProviderSpecific
sb := b[j].ProviderSpecific
sort.Sort(byNames(sa))
sort.Sort(byNames(sb))
return reflect.DeepEqual(sa, sb)
}
return b[i].RecordType <= b[j].RecordType return b[i].RecordType <= b[j].RecordType
} }
return b[i].Targets.String() <= b[j].Targets.String() return b[i].Targets.String() <= b[j].Targets.String()