Skip to content

Commit 6c29494

Browse files
author
Jelle Dijkstra
committed
linting
1 parent e336b55 commit 6c29494

28 files changed

+66
-41
lines changed

api/v2beta1/shared_conversion.go

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

33
import (
44
"fmt"
5+
56
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
67
shared_model "github.com/pdok/smooth-operator/model"
78
autoscalingv2 "k8s.io/api/autoscaling/v2"
@@ -47,6 +48,7 @@ func ConvertOptionsV3ToV2(src *pdoknlv3.Options) WMSWFSOptions {
4748
func ConvertAutoscaling(src Autoscaling) *autoscalingv2.HorizontalPodAutoscalerSpec {
4849
var minReplicas *int32
4950
if src.MinReplicas != nil {
51+
//nolint:gosec
5052
minReplicas = Pointer(int32(*src.MinReplicas))
5153
}
5254

api/v2beta1/wfs_conversion.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ SOFTWARE.
2525
package v2beta1
2626

2727
import (
28-
sharedModel "github.com/pdok/smooth-operator/model"
2928
"log"
3029

30+
sharedModel "github.com/pdok/smooth-operator/model"
31+
3132
"sigs.k8s.io/controller-runtime/pkg/conversion"
3233

3334
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"

api/v2beta1/wms_conversion.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ SOFTWARE.
2525
package v2beta1
2626

2727
import (
28-
"fmt"
29-
sharedModel "github.com/pdok/smooth-operator/model"
28+
"errors"
3029
"log"
3130
"strconv"
3231

32+
sharedModel "github.com/pdok/smooth-operator/model"
33+
3334
"sigs.k8s.io/controller-runtime/pkg/conversion"
3435

3536
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
@@ -256,7 +257,7 @@ func (v2Service WMSService) GetTopLayer() (*WMSLayer, error) {
256257
}
257258
}
258259

259-
return nil, fmt.Errorf("unable to detect the toplayer of this WMS service")
260+
return nil, errors.New("unable to detect the toplayer of this WMS service")
260261
}
261262

262263
func (v2Service WMSService) GetChildLayers(parent WMSLayer) ([]WMSLayer, error) {
@@ -269,7 +270,7 @@ func (v2Service WMSService) GetChildLayers(parent WMSLayer) ([]WMSLayer, error)
269270
}
270271

271272
if len(children) == 0 {
272-
return children, fmt.Errorf("no child layers found")
273+
return children, errors.New("no child layers found")
273274
}
274275

275276
return children, nil

api/v3/shared_types.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package v3
22

33
import (
4+
//nolint:gosec
45
"crypto/sha1"
56
"encoding/hex"
67
"io"
8+
"net/url"
9+
"strings"
10+
711
autoscalingv2 "k8s.io/api/autoscaling/v2"
812
corev1 "k8s.io/api/core/v1"
913
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
10-
"net/url"
11-
"strings"
1214
)
1315

1416
var host string
@@ -160,6 +162,7 @@ func (d *Data) GetGeometryType() *string {
160162
}
161163

162164
func Sha1HashOfName[O WMSWFS](obj O) string {
165+
//nolint:gosec
163166
s := sha1.New()
164167
_, _ = io.WriteString(s, obj.GetName())
165168

api/v3/wfs_validation.go

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

33
import (
44
"fmt"
5-
sharedValidation "github.com/pdok/smooth-operator/pkg/validation"
65
"strings"
6+
7+
sharedValidation "github.com/pdok/smooth-operator/pkg/validation"
78
)
89

910
func (wfs *WFS) ValidateCreate() ([]string, error) {
@@ -36,11 +37,11 @@ func (wfs *WFS) ValidateUpdate(wfsOld *WFS) ([]string, error) {
3637

3738
// Check service.baseURL did not change
3839
if wfs.Spec.Service.URL != wfsOld.Spec.Service.URL {
39-
reasons = append(reasons, fmt.Sprintf("service.baseURL is immutable"))
40+
reasons = append(reasons, "service.baseURL is immutable")
4041
}
4142

4243
if (wfs.Spec.Service.Inspire == nil && wfsOld.Spec.Service.Inspire != nil) || (wfs.Spec.Service.Inspire != nil && wfsOld.Spec.Service.Inspire == nil) {
43-
reasons = append(reasons, fmt.Sprintf("services cannot change from inspire to not inspire or the other way around"))
44+
reasons = append(reasons, "services cannot change from inspire to not inspire or the other way around")
4445
}
4546

4647
validateWFS(wfs, &warnings, &reasons)
@@ -65,7 +66,7 @@ func validateWFS(wfs *WFS, warnings *[]string, reasons *[]string) {
6566
}
6667

6768
if service.Mapfile == nil && service.DefaultCrs != "EPSG:28992" && service.Bbox == nil {
68-
*reasons = append(*reasons, fmt.Sprintf("service.bbox.defaultCRS is required when service.defaultCRS is not 'EPSG:28992'"))
69+
*reasons = append(*reasons, "service.bbox.defaultCRS is required when service.defaultCRS is not 'EPSG:28992'")
6970
}
7071

7172
if service.Mapfile != nil {

api/v3/wms_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ SOFTWARE.
2525
package v3
2626

2727
import (
28+
"maps"
29+
"slices"
30+
"sort"
31+
2832
shared_model "github.com/pdok/smooth-operator/model"
2933
autoscalingv2 "k8s.io/api/autoscaling/v2"
3034
corev1 "k8s.io/api/core/v1"
3135
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
32-
"maps"
33-
"slices"
34-
"sort"
3536
)
3637

3738
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func main() {
258258
os.Exit(1)
259259
}
260260
}
261-
//nolint:goconst
261+
262262
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
263263
if err = webhookpdoknlv3.SetupWFSWebhookWithManager(mgr); err != nil {
264264
setupLog.Error(err, "unable to create webhook", "webhook", "WFS")

config/samples/samples.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package samples
22

33
import (
44
_ "embed"
5+
56
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
67
"sigs.k8s.io/yaml"
78
)

internal/controller/blobdownload/blob_download.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ package blobdownload
33
import (
44
_ "embed"
55
"fmt"
6+
"regexp"
7+
"strings"
8+
69
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
710
"github.com/pdok/mapserver-operator/internal/controller/mapperutils"
811
"github.com/pdok/mapserver-operator/internal/controller/mapserver"
912
"github.com/pdok/mapserver-operator/internal/controller/utils"
1013
corev1 "k8s.io/api/core/v1"
1114
"k8s.io/apimachinery/pkg/api/resource"
12-
"regexp"
13-
"strings"
1415
)
1516

1617
const (

internal/controller/blobdownload/blob_download_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package blobdownload
22

33
import (
4-
v3 "github.com/pdok/mapserver-operator/api/v3"
5-
smoothoperatorutils "github.com/pdok/smooth-operator/pkg/util"
64
"strings"
75
"testing"
6+
7+
v3 "github.com/pdok/mapserver-operator/api/v3"
8+
smoothoperatorutils "github.com/pdok/smooth-operator/pkg/util"
89
)
910

1011
const (

0 commit comments

Comments
 (0)