Skip to content

Commit

Permalink
BUILD/MAJOR: raise minimum Go version to 1.19
Browse files Browse the repository at this point in the history
golang.org/x/sys package is no longer compatible with previous versions, at least not in combination with other packages
  • Loading branch information
oktalz committed Oct 13, 2022
1 parent 6fab443 commit e3b7ce1
Show file tree
Hide file tree
Showing 30 changed files with 232 additions and 245 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: golangci-lint
uses: docker://ghcr.io/haproxytech/go-linter:1.33
uses: docker://ghcr.io/haproxytech/go-linter:1.50.0
with:
args: --timeout 5m
build:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ golangci_lint:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'push'
image:
name: $CI_REGISTRY_GO/lint:1.33
name: $CI_REGISTRY_GO/lint:1.50.0
entrypoint: [""]
tags:
- go
Expand Down
15 changes: 14 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ linters-settings:
govet:
check-shadowing: true
gocyclo:
min-complexity: 25
min-complexity: 42
cyclop:
max-complexity: 42
maligned:
suggest-new: true
dupl:
threshold: 200
revive:
rules:
- name: var-naming
severity: warning
disabled: true

linters:
enable-all: true
Expand All @@ -32,3 +39,9 @@ linters:
- nakedret
- paralleltest
- testpackage
- nonamedreturns
- nosnakecase
- varnamelen
- staticcheck
- exhaustruct
- forcetypeassert
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ doc:
.PHONY: lint
lint:
docker run --rm -v $(pwd):/data cytopia/yamllint .
golangci-lint run --color always --timeout 240s
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

.PHONY: example
example:
Expand Down
2 changes: 1 addition & 1 deletion crs/api/core/v1alpha1/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Global struct {
// GlobalSpec defines the desired state of Global
type GlobalSpec struct {
Config *models.Global `json:"config"`
LogTargets models.LogTargets `json:"log_targets"`
LogTargets models.LogTargets `json:"log_targets"` //nolint:tagliatelle
}

// DeepCopyInto deepcopying the receiver into out. in must be non-nil.
Expand Down
6 changes: 3 additions & 3 deletions deploy/tests/e2e/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func newClient(host string, port int, tls bool) (*Client, error) {
if port != 0 {
dstPort = port
}
req, err := http.NewRequest("GET", fmt.Sprintf("%s://%s", scheme, host), nil)
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s://%s", scheme, host), nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -112,7 +112,7 @@ func NewHTTPSClient(host string, port ...int) (*Client, error) {
return client, nil
}

func (c *Client) Do() (res *http.Response, close func() error, err error) {
func (c *Client) Do() (res *http.Response, closeFunc func() error, err error) {
client := &http.Client{}
if c.Transport != nil {
client.Transport = c.Transport
Expand All @@ -130,7 +130,7 @@ func (c *Client) Do() (res *http.Response, close func() error, err error) {
if err != nil {
return
}
close = res.Body.Close
closeFunc = res.Body.Close
return
}

Expand Down
14 changes: 9 additions & 5 deletions deploy/tests/e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ import (
"k8s.io/client-go/tools/clientcmd"
)

var WaitDuration = 60 * time.Second
var TickDuration = 2 * time.Second
var (
WaitDuration = 60 * time.Second
TickDuration = 2 * time.Second
)

var devModeFlag = flag.Bool("dev", false, "keep test environment after finishing")
var devMode bool
var (
devModeFlag = flag.Bool("dev", false, "keep test environment after finishing")
devMode bool
)

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

func (t *Test) Delete(path string) error {
Expand Down
2 changes: 1 addition & 1 deletion deploy/tests/integration/customresources/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (suite *CustomResourceSuite) GlobalCRFixture() (eventChan chan k8s.SyncData
var osArgs utils.OSArgs
os.Args = []string{os.Args[0], "-e", "-t", "--config-dir=" + suite.test.TempDir}
parser := flags.NewParser(&osArgs, flags.IgnoreUnknown)
_, errParsing := parser.Parse()
_, errParsing := parser.Parse() //nolint:ifshort
if errParsing != nil {
suite.T().Fatal(errParsing)
}
Expand Down
7 changes: 4 additions & 3 deletions deploy/tests/tnr/routeacl/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (suite *UseBackendSuite) BeforeTest(suiteName, testName string) {
suite.T().Logf("temporary configuration dir %s", suite.test.TempDir)
}

//nolint:dupword
var haproxyConfig = `global
daemon
master-worker
Expand Down Expand Up @@ -96,7 +97,7 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8s.SyncDataEv
var osArgs utils.OSArgs
os.Args = []string{os.Args[0], "-e", "-t", "--config-dir=" + suite.test.TempDir}
parser := flags.NewParser(&osArgs, flags.IgnoreUnknown)
_, errParsing := parser.Parse()
_, errParsing := parser.Parse() //nolint:ifshort
if errParsing != nil {
suite.T().Fatal(errParsing)
}
Expand Down Expand Up @@ -147,7 +148,8 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8s.SyncDataEv
Namespace: ns.Name,
Annotations: map[string]string{"route-acl": "cookie(staging) -m found"},
Ports: []store.ServicePort{
{Name: "https",
{
Name: "https",
Protocol: "TCP",
Port: 443,
Status: store.ADDED,
Expand All @@ -166,7 +168,6 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8s.SyncDataEv
Annotations: map[string]string{"haproxy.org/ingress.class": "haproxy"},
Rules: map[string]*store.IngressRule{
"": {

Paths: map[string]*store.IngressPath{
string(prefixPathType) + "-/": {
Path: "/",
Expand Down
77 changes: 40 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module github.com/haproxytech/kubernetes-ingress

go 1.17
go 1.19

require (
github.com/fasthttp/router v1.4.9
github.com/go-test/deep v1.0.7
github.com/fasthttp/router v1.4.12
github.com/go-test/deep v1.0.8
github.com/google/renameio v1.0.1
github.com/haproxytech/client-native/v3 v3.1.1-0.20220520145135-9afaaf96bc7f
github.com/haproxytech/config-parser/v4 v4.0.0-rc2.0.20220428133329-7d0ec01198d4
github.com/jessevdk/go-flags v1.4.0
github.com/pires/go-proxyproto v0.6.1
github.com/prometheus/client_golang v1.12.1
github.com/stretchr/testify v1.7.0
github.com/valyala/fasthttp v1.36.0
k8s.io/api v0.22.2
k8s.io/apimachinery v0.22.2
k8s.io/client-go v0.22.2
github.com/pires/go-proxyproto v0.6.2
github.com/prometheus/client_golang v1.13.0
github.com/stretchr/testify v1.8.0
github.com/valyala/fasthttp v1.40.0
k8s.io/api v0.25.2
k8s.io/apimachinery v0.25.2
k8s.io/client-go v0.25.2
)

require (
Expand All @@ -26,60 +26,63 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/analysis v0.19.10 // indirect
github.com/go-openapi/errors v0.19.4 // indirect
github.com/go-openapi/jsonpointer v0.19.3 // indirect
github.com/go-openapi/jsonreference v0.19.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/loads v0.19.5 // indirect
github.com/go-openapi/runtime v0.19.15 // indirect
github.com/go-openapi/spec v0.19.7 // indirect
github.com/go-openapi/strfmt v0.19.5 // indirect
github.com/go-openapi/swag v0.19.7 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-openapi/validate v0.19.3 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/haproxytech/go-logger v1.0.1-0.20211022075555-178f1cdf4d84 // indirect
github.com/imdario/mergo v0.3.5 // indirect
github.com/haproxytech/go-logger v1.1.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.15.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/savsgio/gotils v0.0.0-20220401102855-e56b59f40436 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
go.mongodb.org/mongo-driver v1.5.1 // indirect
golang.org/x/net v0.0.0-20220921203646-d300de134e69 // indirect
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
go.mongodb.org/mongo-driver v1.10.3 // indirect
golang.org/x/net v0.0.0-20221004154528-8021a29435af // indirect
golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1 // indirect
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
golang.org/x/term v0.0.0-20220919170432-7a66f970e087 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.26.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/klog/v2 v2.9.0 // indirect
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
Loading

0 comments on commit e3b7ce1

Please sign in to comment.