Skip to content

Commit 237b5a8

Browse files
author
Jelle Dijkstra
committed
Tests
1 parent 2ee2fb5 commit 237b5a8

File tree

25 files changed

+962
-216
lines changed

25 files changed

+962
-216
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
- name: Run linter
2121
uses: golangci/golangci-lint-action@v6
2222
with:
23-
version: v1.63.4
23+
version: v1.64.8

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM docker.io/golang:1.23 AS builder
2+
FROM docker.io/golang:1.24 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

@@ -8,8 +8,6 @@ WORKDIR /workspace
88
COPY go.mod go.mod
99
COPY go.sum go.sum
1010

11-
COPY --from=repos ./smooth-operator /smooth-operator
12-
1311
# cache deps before building and copying source so that we don't need to re-download as much
1412
# and so that source changes don't invalidate our downloaded layer
1513
RUN go mod download

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.17.1
179179
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
180180
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
181181
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
182-
GOLANGCI_LINT_VERSION ?= v1.63.4
182+
GOLANGCI_LINT_VERSION ?= v1.64.8
183183

184184
.PHONY: kustomize
185185
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.

api/v2beta1/shared_conversion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ func Pointer[T interface{}](val T) *T {
1515
func PointerVal[T interface{}](val *T, def T) T {
1616
if val == nil {
1717
return def
18-
} else {
19-
return *val
2018
}
19+
20+
return *val
2121
}
2222

2323
func ConverseOptionsV2ToV3(src WMSWFSOptions) *pdoknlv3.Options {

api/v2beta1/wfs_conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (dst *WFS) ConvertFrom(srcRaw conversion.Hub) error {
190190
service.MetadataIdentifier = src.Spec.Service.Inspire.ServiceMetadataURL.CSW.MetadataIdentifier
191191
} else {
192192
service.Inspire = false
193-
// TODO unable to fill in MetadataIdentifier here untill we know how to handle non inspire services
193+
// TODO unable to fill in MetadataIdentifier here until we know how to handle non inspire services
194194
}
195195

196196
for _, featureType := range src.Spec.Service.FeatureTypes {

api/v2beta1/wms_conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func (dst *WMS) ConvertFrom(srcRaw conversion.Hub) error {
169169
service.MetadataIdentifier = src.Spec.Service.Inspire.ServiceMetadataURL.CSW.MetadataIdentifier
170170
} else {
171171
service.Inspire = false
172-
// TODO unable to fill in MetadataIdentifier here untill we know how to handle non inspire services
172+
// TODO unable to fill in MetadataIdentifier here until we know how to handle non inspire services
173173
}
174174

175175
uuid, ok := src.Annotations[SERVICE_METADATA_IDENTIFIER_ANNOTATION]

api/v3/shared_types.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v3
22

33
import (
44
"crypto/sha1"
5+
"encoding/hex"
56
"io"
67
autoscalingv2 "k8s.io/api/autoscaling/v2"
78
corev1 "k8s.io/api/core/v1"
@@ -31,7 +32,7 @@ type WMSWFS interface {
3132
Options() *Options
3233
HasPostgisData() bool
3334
// Sha1 hash of the objects name
34-
Id() string
35+
ID() string
3536
}
3637

3738
type Mapfile struct {
@@ -109,19 +110,19 @@ func GetHost() string {
109110
}
110111

111112
func GetBaseURLPath[T *WFS | *WMS](o T) string {
112-
var serviceUrl string
113+
var serviceURL string
113114
switch any(o).(type) {
114115
case *WFS:
115116
if WFS, ok := any(o).(*WFS); ok {
116-
serviceUrl = WFS.Spec.Service.URL
117+
serviceURL = WFS.Spec.Service.URL
117118
}
118119
case *WMS:
119120
if WMS, ok := any(o).(*WMS); ok {
120-
serviceUrl = WMS.Spec.Service.URL
121+
serviceURL = WMS.Spec.Service.URL
121122
}
122123
}
123124

124-
parsed, _ := url.Parse(serviceUrl)
125+
parsed, _ := url.Parse(serviceURL)
125126
return strings.TrimPrefix(parsed.Path, "/")
126127
}
127128

@@ -160,7 +161,7 @@ func (d *Data) GetGeometryType() *string {
160161

161162
func Sha1HashOfName[O WMSWFS](obj O) string {
162163
s := sha1.New()
163-
io.WriteString(s, obj.GetName())
164+
_, _ = io.WriteString(s, obj.GetName())
164165

165-
return string(s.Sum(nil))
166+
return hex.EncodeToString(s.Sum(nil))
166167
}

api/v3/wfs_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,6 @@ func (wfs *WFS) Options() *Options {
147147
return wfs.Spec.Options
148148
}
149149

150-
func (wfs *WFS) Id() string {
150+
func (wfs *WFS) ID() string {
151151
return Sha1HashOfName(wfs)
152152
}

api/v3/wfs_validation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ func (wfs *WFS) ValidateCreate() ([]string, error) {
1919

2020
if len(reasons) > 0 {
2121
return warnings, fmt.Errorf("%s", strings.Join(reasons, ". "))
22-
} else {
23-
return warnings, nil
2422
}
23+
24+
return warnings, nil
2525
}
2626

2727
func (wfs *WFS) ValidateUpdate(wfsOld *WFS) ([]string, error) {
@@ -47,9 +47,9 @@ func (wfs *WFS) ValidateUpdate(wfsOld *WFS) ([]string, error) {
4747

4848
if len(reasons) > 0 {
4949
return warnings, fmt.Errorf("%s", strings.Join(reasons, ". "))
50-
} else {
51-
return warnings, nil
5250
}
51+
52+
return warnings, nil
5353
}
5454

5555
func validateWFS(wfs *WFS, warnings *[]string, reasons *[]string) {

api/v3/wms_types.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,15 @@ func (wms *WMS) GetUniqueTiffBlobKeys() []string {
217217
func (wms *WMS) GetAuthority() *Authority {
218218
if wms.Spec.Service.Layer.Authority != nil {
219219
return wms.Spec.Service.Layer.Authority
220-
} else {
221-
for _, childLayer := range *wms.Spec.Service.Layer.Layers {
222-
if childLayer.Authority != nil {
223-
return childLayer.Authority
224-
} else if childLayer.Layers != nil {
225-
for _, grandChildLayer := range *childLayer.Layers {
226-
if grandChildLayer.Authority != nil {
227-
return grandChildLayer.Authority
228-
}
220+
}
221+
222+
for _, childLayer := range *wms.Spec.Service.Layer.Layers {
223+
if childLayer.Authority != nil {
224+
return childLayer.Authority
225+
} else if childLayer.Layers != nil {
226+
for _, grandChildLayer := range *childLayer.Layers {
227+
if grandChildLayer.Authority != nil {
228+
return grandChildLayer.Authority
229229
}
230230
}
231231
}
@@ -263,6 +263,6 @@ func (wms *WMS) Options() *Options {
263263
return wms.Spec.Options
264264
}
265265

266-
func (wms *WMS) Id() string {
266+
func (wms *WMS) ID() string {
267267
return Sha1HashOfName(wms)
268268
}

0 commit comments

Comments
 (0)