Skip to content

Commit c1a980e

Browse files
committed
BUILD/MAJOR: ci: apply new linting rules
1 parent 892052b commit c1a980e

File tree

16 files changed

+35
-37
lines changed

16 files changed

+35
-37
lines changed

crs/generated/clientset/versioned/fake/register.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crs/generated/clientset/versioned/scheme/register.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/tests/e2e/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"crypto/tls"
2222
"fmt"
23-
"io/ioutil"
23+
"io"
2424
"net"
2525
"net/http"
2626
"os"
@@ -177,7 +177,7 @@ func ProxyProtoConn() (result []byte, err error) {
177177
return
178178
}
179179

180-
return ioutil.ReadAll(conn)
180+
return io.ReadAll(conn)
181181
}
182182

183183
func runtimeCommand(command string) (result []byte, err error) {

deploy/tests/e2e/haproxy-files/patternfiles_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
package haproxyfiles
1818

1919
import (
20-
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
2120
"strconv"
21+
22+
"github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e"
2223
)
2324

2425
var tests1 = []string{

deploy/tests/e2e/ingress-match/ingress_match_path_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var ingressRules = []IngressRule{
4444
{Service: "http-echo-9", Host: "*.haproxy", PathType: "ImplementationSpecific"},
4545
{Service: "http-echo-10", Path: "/test", PathType: "ImplementationSpecific"},
4646
}
47+
4748
var tests = []test{
4849
{ingressRules[0].Service, "app.haproxy", []string{"/", "/test", "/exact/", "/exactslash", "/exactslash/foo", "/prefixxx"}},
4950
{ingressRules[1].Service, "app.haproxy", []string{"/a"}},

deploy/tests/e2e/service-discovery/port_discovery.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,4 @@ func (suite *ServiceDiscoverySuite) testServicePort(serviceName, servicePort, po
5050
}
5151
return strings.HasPrefix(string(body), serviceName)
5252
}, e2e.WaitDuration, e2e.TickDuration)
53-
5453
}

deploy/tests/e2e/utils.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"flag"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"os/exec"
109
"path/filepath"
@@ -54,7 +53,7 @@ func NewTest() (test Test, err error) {
5453
return nil
5554
}}
5655
// TemplateDir
57-
test.templateDir, err = ioutil.TempDir("/tmp/", "haproxy-ic-test-tmpl")
56+
test.templateDir, err = os.MkdirTemp("/tmp/", "haproxy-ic-test-tmpl")
5857
if err != nil {
5958
return test, fmt.Errorf("error creating template dir: %w ", err)
6059
}
@@ -73,7 +72,7 @@ func (t *Test) Apply(path string, namespace string, tmplData interface{}) error
7372
return err
7473
}
7574
}
76-
if file, err = ioutil.ReadFile(path); err != nil {
75+
if file, err = os.ReadFile(path); err != nil {
7776
return fmt.Errorf("error reading yaml file: %w", err)
7877
}
7978
// kubectl -n $NS apply -f -
@@ -84,7 +83,7 @@ func (t *Test) Apply(path string, namespace string, tmplData interface{}) error
8483
}
8584

8685
func (t *Test) processTemplate(path string, tmplData interface{}) (string, error) {
87-
file, err := ioutil.ReadFile(path)
86+
file, err := os.ReadFile(path)
8887
if err != nil {
8988
return "", fmt.Errorf("error reading yaml template: %w", err)
9089
}
@@ -95,13 +94,13 @@ func (t *Test) processTemplate(path string, tmplData interface{}) (string, error
9594
return "", fmt.Errorf("error parsing yaml template: %w", err)
9695
}
9796
yaml := filepath.Join(t.templateDir, t.namespace+time.Now().Format("2006-01-02-1504051111")+".yaml")
98-
return yaml, ioutil.WriteFile(yaml, result.Bytes(), 0o600)
97+
return yaml, os.WriteFile(yaml, result.Bytes(), 0o600)
9998
}
10099

101100
func (t *Test) Delete(path string) error {
102101
var err error
103102
var file []byte
104-
if file, err = ioutil.ReadFile(path); err != nil {
103+
if file, err = os.ReadFile(path); err != nil {
105104
return fmt.Errorf("error reading yaml file: %w", err)
106105
}
107106
if out, errApply := t.execute(string(file), "kubectl", "delete", "-f", "-"); errApply != nil {

deploy/tests/images/http-echo/handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func (c context) echoHostname(writer http.ResponseWriter, request *http.Request)
1515
fmt.Fprintln(writer, c.hostname)
1616
}
1717

18-
// echoAll echos back request in response
18+
// echoAll echos back request in response
1919
func (c context) echoAll(writer http.ResponseWriter, request *http.Request) {
2020
log.Println("Echoing back request made to " + request.URL.Path + " to client (" + request.RemoteAddr + ")")
2121
attr := make(map[string]interface{})

deploy/tests/integration/customresources/suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package customresources
1616

1717
import (
18-
"io/ioutil"
1918
"os"
2019
"path/filepath"
2120
"testing"
@@ -48,7 +47,7 @@ type Test struct {
4847
}
4948

5049
func (suite *CustomResourceSuite) BeforeTest(suiteName, testName string) {
51-
tempDir, err := ioutil.TempDir("", "ut-"+testName+"-*")
50+
tempDir, err := os.MkdirTemp("", "ut-"+testName+"-*")
5251
if err != nil {
5352
suite.T().Fatalf("Suite '%s': Test '%s' : error : %s", suiteName, testName, err)
5453
}

deploy/tests/tnr/routeacl/suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package routeacl
1616

1717
import (
18-
"io/ioutil"
1918
"os"
2019
"testing"
2120

@@ -46,7 +45,7 @@ type Test struct {
4645
}
4746

4847
func (suite *UseBackendSuite) BeforeTest(suiteName, testName string) {
49-
tempDir, err := ioutil.TempDir("", "tnr-"+testName+"-*")
48+
tempDir, err := os.MkdirTemp("", "tnr-"+testName+"-*")
5049
if err != nil {
5150
suite.T().Fatalf("Suite '%s': Test '%s' : error : %s", suiteName, testName, err)
5251
}

0 commit comments

Comments
 (0)