Skip to content

Commit e3b7ce1

Browse files
committed
BUILD/MAJOR: raise minimum Go version to 1.19
golang.org/x/sys package is no longer compatible with previous versions, at least not in combination with other packages
1 parent 6fab443 commit e3b7ce1

File tree

30 files changed

+232
-245
lines changed

30 files changed

+232
-245
lines changed

.github/workflows/actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
restore-keys: |
6868
${{ runner.os }}-go-
6969
- name: golangci-lint
70-
uses: docker://ghcr.io/haproxytech/go-linter:1.33
70+
uses: docker://ghcr.io/haproxytech/go-linter:1.50.0
7171
with:
7272
args: --timeout 5m
7373
build:

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ golangci_lint:
5151
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
5252
- if: $CI_PIPELINE_SOURCE == 'push'
5353
image:
54-
name: $CI_REGISTRY_GO/lint:1.33
54+
name: $CI_REGISTRY_GO/lint:1.50.0
5555
entrypoint: [""]
5656
tags:
5757
- go

.golangci.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ linters-settings:
22
govet:
33
check-shadowing: true
44
gocyclo:
5-
min-complexity: 25
5+
min-complexity: 42
6+
cyclop:
7+
max-complexity: 42
68
maligned:
79
suggest-new: true
810
dupl:
911
threshold: 200
12+
revive:
13+
rules:
14+
- name: var-naming
15+
severity: warning
16+
disabled: true
1017

1118
linters:
1219
enable-all: true
@@ -32,3 +39,9 @@ linters:
3239
- nakedret
3340
- paralleltest
3441
- testpackage
42+
- nonamedreturns
43+
- nosnakecase
44+
- varnamelen
45+
- staticcheck
46+
- exhaustruct
47+
- forcetypeassert

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ doc:
2222
.PHONY: lint
2323
lint:
2424
docker run --rm -v $(pwd):/data cytopia/yamllint .
25-
golangci-lint run --color always --timeout 240s
25+
docker run --rm -v ${PROJECT_PATH}:/app -w /app ghcr.io/haproxytech/go-linter:1.50.0 -v --timeout 5m --color always --max-issues-per-linter 0 --max-same-issues 0
2626

2727
.PHONY: example
2828
example:

crs/api/core/v1alpha1/global.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Global struct {
3434
// GlobalSpec defines the desired state of Global
3535
type GlobalSpec struct {
3636
Config *models.Global `json:"config"`
37-
LogTargets models.LogTargets `json:"log_targets"`
37+
LogTargets models.LogTargets `json:"log_targets"` //nolint:tagliatelle
3838
}
3939

4040
// DeepCopyInto deepcopying the receiver into out. in must be non-nil.

deploy/tests/e2e/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func newClient(host string, port int, tls bool) (*Client, error) {
6767
if port != 0 {
6868
dstPort = port
6969
}
70-
req, err := http.NewRequest("GET", fmt.Sprintf("%s://%s", scheme, host), nil)
70+
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s://%s", scheme, host), nil)
7171
if err != nil {
7272
return nil, err
7373
}
@@ -112,7 +112,7 @@ func NewHTTPSClient(host string, port ...int) (*Client, error) {
112112
return client, nil
113113
}
114114

115-
func (c *Client) Do() (res *http.Response, close func() error, err error) {
115+
func (c *Client) Do() (res *http.Response, closeFunc func() error, err error) {
116116
client := &http.Client{}
117117
if c.Transport != nil {
118118
client.Transport = c.Transport
@@ -130,7 +130,7 @@ func (c *Client) Do() (res *http.Response, close func() error, err error) {
130130
if err != nil {
131131
return
132132
}
133-
close = res.Body.Close
133+
closeFunc = res.Body.Close
134134
return
135135
}
136136

deploy/tests/e2e/utils.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ import (
1717
"k8s.io/client-go/tools/clientcmd"
1818
)
1919

20-
var WaitDuration = 60 * time.Second
21-
var TickDuration = 2 * time.Second
20+
var (
21+
WaitDuration = 60 * time.Second
22+
TickDuration = 2 * time.Second
23+
)
2224

23-
var devModeFlag = flag.Bool("dev", false, "keep test environment after finishing")
24-
var devMode bool
25+
var (
26+
devModeFlag = flag.Bool("dev", false, "keep test environment after finishing")
27+
devMode bool
28+
)
2529

2630
type Test struct {
2731
namespace string
@@ -91,7 +95,7 @@ func (t *Test) processTemplate(path string, tmplData interface{}) (string, error
9195
return "", fmt.Errorf("error parsing yaml template: %w", err)
9296
}
9397
yaml := filepath.Join(t.templateDir, t.namespace+time.Now().Format("2006-01-02-1504051111")+".yaml")
94-
return yaml, ioutil.WriteFile(yaml, result.Bytes(), 0600)
98+
return yaml, ioutil.WriteFile(yaml, result.Bytes(), 0o600)
9599
}
96100

97101
func (t *Test) Delete(path string) error {

deploy/tests/integration/customresources/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (suite *CustomResourceSuite) GlobalCRFixture() (eventChan chan k8s.SyncData
9898
var osArgs utils.OSArgs
9999
os.Args = []string{os.Args[0], "-e", "-t", "--config-dir=" + suite.test.TempDir}
100100
parser := flags.NewParser(&osArgs, flags.IgnoreUnknown)
101-
_, errParsing := parser.Parse()
101+
_, errParsing := parser.Parse() //nolint:ifshort
102102
if errParsing != nil {
103103
suite.T().Fatal(errParsing)
104104
}

deploy/tests/tnr/routeacl/suite_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func (suite *UseBackendSuite) BeforeTest(suiteName, testName string) {
5454
suite.T().Logf("temporary configuration dir %s", suite.test.TempDir)
5555
}
5656

57+
//nolint:dupword
5758
var haproxyConfig = `global
5859
daemon
5960
master-worker
@@ -96,7 +97,7 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8s.SyncDataEv
9697
var osArgs utils.OSArgs
9798
os.Args = []string{os.Args[0], "-e", "-t", "--config-dir=" + suite.test.TempDir}
9899
parser := flags.NewParser(&osArgs, flags.IgnoreUnknown)
99-
_, errParsing := parser.Parse()
100+
_, errParsing := parser.Parse() //nolint:ifshort
100101
if errParsing != nil {
101102
suite.T().Fatal(errParsing)
102103
}
@@ -147,7 +148,8 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8s.SyncDataEv
147148
Namespace: ns.Name,
148149
Annotations: map[string]string{"route-acl": "cookie(staging) -m found"},
149150
Ports: []store.ServicePort{
150-
{Name: "https",
151+
{
152+
Name: "https",
151153
Protocol: "TCP",
152154
Port: 443,
153155
Status: store.ADDED,
@@ -166,7 +168,6 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8s.SyncDataEv
166168
Annotations: map[string]string{"haproxy.org/ingress.class": "haproxy"},
167169
Rules: map[string]*store.IngressRule{
168170
"": {
169-
170171
Paths: map[string]*store.IngressPath{
171172
string(prefixPathType) + "-/": {
172173
Path: "/",

go.mod

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
module github.com/haproxytech/kubernetes-ingress
22

3-
go 1.17
3+
go 1.19
44

55
require (
6-
github.com/fasthttp/router v1.4.9
7-
github.com/go-test/deep v1.0.7
6+
github.com/fasthttp/router v1.4.12
7+
github.com/go-test/deep v1.0.8
88
github.com/google/renameio v1.0.1
99
github.com/haproxytech/client-native/v3 v3.1.1-0.20220520145135-9afaaf96bc7f
1010
github.com/haproxytech/config-parser/v4 v4.0.0-rc2.0.20220428133329-7d0ec01198d4
1111
github.com/jessevdk/go-flags v1.4.0
12-
github.com/pires/go-proxyproto v0.6.1
13-
github.com/prometheus/client_golang v1.12.1
14-
github.com/stretchr/testify v1.7.0
15-
github.com/valyala/fasthttp v1.36.0
16-
k8s.io/api v0.22.2
17-
k8s.io/apimachinery v0.22.2
18-
k8s.io/client-go v0.22.2
12+
github.com/pires/go-proxyproto v0.6.2
13+
github.com/prometheus/client_golang v1.13.0
14+
github.com/stretchr/testify v1.8.0
15+
github.com/valyala/fasthttp v1.40.0
16+
k8s.io/api v0.25.2
17+
k8s.io/apimachinery v0.25.2
18+
k8s.io/client-go v0.25.2
1919
)
2020

2121
require (
@@ -26,60 +26,63 @@ require (
2626
github.com/beorn7/perks v1.0.1 // indirect
2727
github.com/cespare/xxhash/v2 v2.1.2 // indirect
2828
github.com/davecgh/go-spew v1.1.1 // indirect
29-
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
30-
github.com/go-logr/logr v0.4.0 // indirect
29+
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
30+
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
31+
github.com/go-logr/logr v1.2.3 // indirect
3132
github.com/go-openapi/analysis v0.19.10 // indirect
3233
github.com/go-openapi/errors v0.19.4 // indirect
33-
github.com/go-openapi/jsonpointer v0.19.3 // indirect
34-
github.com/go-openapi/jsonreference v0.19.3 // indirect
34+
github.com/go-openapi/jsonpointer v0.19.5 // indirect
35+
github.com/go-openapi/jsonreference v0.19.5 // indirect
3536
github.com/go-openapi/loads v0.19.5 // indirect
3637
github.com/go-openapi/runtime v0.19.15 // indirect
3738
github.com/go-openapi/spec v0.19.7 // indirect
3839
github.com/go-openapi/strfmt v0.19.5 // indirect
39-
github.com/go-openapi/swag v0.19.7 // indirect
40+
github.com/go-openapi/swag v0.19.14 // indirect
4041
github.com/go-openapi/validate v0.19.3 // indirect
41-
github.com/go-stack/stack v1.8.0 // indirect
4242
github.com/gofrs/flock v0.8.1 // indirect
4343
github.com/gogo/protobuf v1.3.2 // indirect
4444
github.com/golang/protobuf v1.5.2 // indirect
45-
github.com/google/go-cmp v0.5.5 // indirect
45+
github.com/google/gnostic v0.5.7-v3refs // indirect
46+
github.com/google/go-cmp v0.5.8 // indirect
4647
github.com/google/gofuzz v1.1.0 // indirect
4748
github.com/google/uuid v1.3.0 // indirect
48-
github.com/googleapis/gnostic v0.5.5 // indirect
49-
github.com/haproxytech/go-logger v1.0.1-0.20211022075555-178f1cdf4d84 // indirect
50-
github.com/imdario/mergo v0.3.5 // indirect
49+
github.com/haproxytech/go-logger v1.1.0 // indirect
50+
github.com/imdario/mergo v0.3.13 // indirect
51+
github.com/josharian/intern v1.0.0 // indirect
5152
github.com/json-iterator/go v1.1.12 // indirect
5253
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
5354
github.com/klauspost/compress v1.15.0 // indirect
5455
github.com/kr/pretty v0.3.0 // indirect
55-
github.com/mailru/easyjson v0.7.1 // indirect
56+
github.com/mailru/easyjson v0.7.6 // indirect
5657
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
5758
github.com/mitchellh/mapstructure v1.2.2 // indirect
5859
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5960
github.com/modern-go/reflect2 v1.0.2 // indirect
61+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6062
github.com/pkg/errors v0.9.1 // indirect
6163
github.com/pmezard/go-difflib v1.0.0 // indirect
6264
github.com/prometheus/client_model v0.2.0 // indirect
63-
github.com/prometheus/common v0.32.1 // indirect
64-
github.com/prometheus/procfs v0.7.3 // indirect
65-
github.com/savsgio/gotils v0.0.0-20220401102855-e56b59f40436 // indirect
65+
github.com/prometheus/common v0.37.0 // indirect
66+
github.com/prometheus/procfs v0.8.0 // indirect
67+
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d // indirect
6668
github.com/spf13/pflag v1.0.5 // indirect
6769
github.com/valyala/bytebufferpool v1.0.0 // indirect
68-
go.mongodb.org/mongo-driver v1.5.1 // indirect
69-
golang.org/x/net v0.0.0-20220921203646-d300de134e69 // indirect
70-
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
71-
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
72-
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
70+
go.mongodb.org/mongo-driver v1.10.3 // indirect
71+
golang.org/x/net v0.0.0-20221004154528-8021a29435af // indirect
72+
golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1 // indirect
73+
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
74+
golang.org/x/term v0.0.0-20220919170432-7a66f970e087 // indirect
7375
golang.org/x/text v0.3.7 // indirect
74-
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
75-
google.golang.org/appengine v1.6.6 // indirect
76-
google.golang.org/protobuf v1.26.0 // indirect
76+
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
77+
google.golang.org/appengine v1.6.7 // indirect
78+
google.golang.org/protobuf v1.28.1 // indirect
7779
gopkg.in/inf.v0 v0.9.1 // indirect
7880
gopkg.in/yaml.v2 v2.4.0 // indirect
79-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
80-
k8s.io/klog/v2 v2.9.0 // indirect
81-
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
82-
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect
83-
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
81+
gopkg.in/yaml.v3 v3.0.1 // indirect
82+
k8s.io/klog/v2 v2.70.1 // indirect
83+
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
84+
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
85+
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
86+
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
8487
sigs.k8s.io/yaml v1.2.0 // indirect
8588
)

0 commit comments

Comments
 (0)