Skip to content

Commit a15757d

Browse files
committed
Use golanglint-ci 2.x
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 3c30868 commit a15757d

2,504 files changed

Lines changed: 138868 additions & 64971 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.golangci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "2"
2+
linters:
3+
default: standard
4+
enable:
5+
- unparam
6+
7+
formatters:
8+
enable:
9+
- gofmt
10+
- goimports
11+
settings:
12+
gofmt:
13+
rewrite-rules:
14+
- pattern: 'interface{}'
15+
replacement: 'any'
16+
17+
issues:
18+
max-same-issues: 100
19+
20+
exclude-files:
21+
- generated.*\\.go
22+
23+
exclude-dirs:
24+
- client
25+
- vendor
26+
27+
run:
28+
timeout: 10m

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ test: $(BUILD_DIRS)
171171
./hack/test.sh $(SRC_PKGS) \
172172
"
173173

174-
ADDTL_LINTERS := goconst,gofmt,goimports,unparam
175-
176174
.PHONY: lint
177175
lint: $(BUILD_DIRS)
178176
@echo "running linter"
@@ -190,7 +188,7 @@ lint: $(BUILD_DIRS)
190188
--env GO111MODULE=on \
191189
--env GOFLAGS="-mod=vendor" \
192190
$(BUILD_IMAGE) \
193-
golangci-lint run --enable $(ADDTL_LINTERS) --timeout=10m --exclude-files="generated.*\.go$\" --exclude-dirs-use-default
191+
golangci-lint run
194192

195193
$(BUILD_DIRS):
196194
@mkdir -p $@

ace_license.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ func (c *Client) GetLicensePlan(licenseData, clusterID, productID string, produc
5858
return "", fmt.Errorf("license isn't issued for this cluster")
5959
} else if license.Status != "active" {
6060
return "", fmt.Errorf("license status isn't active, current status: %s", license.Status)
61-
} else if license.NotBefore.Time.Unix() > jwt.NewNumericDate(time.Now()).Time.Unix() {
62-
return "", fmt.Errorf("license isn't active yet. It will be activated on %v", license.NotBefore.Time.UTC())
63-
} else if license.Expiry.Time.Unix() < jwt.NewNumericDate(time.Now()).Time.Unix() {
64-
return "", fmt.Errorf("license expired on: %v", license.Expiry.Time.UTC())
61+
} else if license.NotBefore.Unix() > jwt.NewNumericDate(time.Now()).Unix() {
62+
return "", fmt.Errorf("license isn't active yet. It will be activated on %v", license.NotBefore.UTC())
63+
} else if license.Expiry.Unix() < jwt.NewNumericDate(time.Now()).Unix() {
64+
return "", fmt.Errorf("license expired on: %v", license.Expiry.UTC())
6565
}
6666

6767
prod, err := c.GetProductByID(productID)

client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (c *Client) getResponse(method, path string, header http.Header, body io.Re
134134
if err != nil {
135135
return nil, err
136136
}
137-
defer resp.Body.Close()
137+
defer resp.Body.Close() // nolint:errcheck
138138

139139
data, err := io.ReadAll(resp.Body)
140140
if err != nil {
@@ -147,7 +147,7 @@ func (c *Client) getResponse(method, path string, header http.Header, body io.Re
147147
return data, nil
148148
}
149149

150-
func (c *Client) getParsedResponse(method, path string, header http.Header, body io.Reader, obj interface{}) error {
150+
func (c *Client) getParsedResponse(method, path string, header http.Header, body io.Reader, obj any) error {
151151
data, err := c.getResponse(method, path, header, body)
152152
if err != nil {
153153
return err
@@ -160,7 +160,7 @@ func (c *Client) getResponseWithCookies(method, path string, header http.Header,
160160
if err != nil {
161161
return nil, nil, err
162162
}
163-
defer resp.Body.Close()
163+
defer resp.Body.Close() // nolint:errcheck
164164

165165
data, err := io.ReadAll(resp.Body)
166166
if err != nil {
@@ -183,7 +183,7 @@ func (c *Client) getStatusCode(method, path string, header http.Header, body io.
183183
if err != nil {
184184
return -1, err
185185
}
186-
defer resp.Body.Close()
186+
defer resp.Body.Close() // nolint:errcheck
187187

188188
return resp.StatusCode, nil
189189
}
@@ -203,11 +203,11 @@ func parseStatusCode(statusCode int, data []byte) error {
203203
}
204204

205205
if statusCode/100 != 2 {
206-
errMap := make(map[string]interface{})
206+
errMap := make(map[string]any)
207207
if err := json.Unmarshal(data, &errMap); err != nil {
208208
// when the JSON can't be parsed, data was probably empty or a plain string,
209209
// so we try to return a helpful error anyway
210-
return fmt.Errorf("Unknown API Error: %d %s", statusCode, string(data))
210+
return fmt.Errorf("unknown API Error: %d %s", statusCode, string(data))
211211
}
212212
return errors.New(errMap["message"].(string))
213213
}

client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func TestClient_getParsedResponse(t *testing.T) {
187187
path string
188188
header http.Header
189189
body io.Reader
190-
obj interface{}
190+
obj any
191191
}
192192
tests := []struct {
193193
name string

go.mod

Lines changed: 66 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,114 @@
11
module go.bytebuilders.dev/client
22

3-
go 1.22.1
4-
5-
toolchain go1.22.4
3+
go 1.25.5
64

75
require (
8-
github.com/golang-jwt/jwt/v5 v5.2.1
9-
github.com/nats-io/nats.go v1.37.0
10-
github.com/stretchr/testify v1.9.0
11-
go.bytebuilders.dev/resource-model v0.1.0
12-
k8s.io/apimachinery v0.30.2
13-
k8s.io/client-go v0.30.2
14-
kmodules.xyz/resource-metadata v0.20.0
15-
x-helm.dev/apimachinery v0.0.16
6+
github.com/golang-jwt/jwt/v5 v5.2.2
7+
github.com/nats-io/nats.go v1.47.0
8+
github.com/stretchr/testify v1.11.1
9+
go.bytebuilders.dev/resource-model v0.3.0
10+
k8s.io/apimachinery v0.32.8
11+
k8s.io/client-go v0.32.8
12+
kmodules.xyz/resource-metadata v0.40.1
13+
x-helm.dev/apimachinery v0.0.17
1614
)
1715

1816
require (
17+
dario.cat/mergo v1.0.1 // indirect
1918
github.com/Masterminds/goutils v1.1.1 // indirect
20-
github.com/Masterminds/semver/v3 v3.3.0 // indirect
21-
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
19+
github.com/Masterminds/semver/v3 v3.3.1 // indirect
20+
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
2221
github.com/beorn7/perks v1.0.1 // indirect
2322
github.com/cespare/xxhash/v2 v2.3.0 // indirect
24-
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
23+
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
2524
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
26-
github.com/docker/cli v24.0.9+incompatible // indirect
27-
github.com/docker/distribution v2.8.2+incompatible // indirect
28-
github.com/docker/docker v25.0.6+incompatible // indirect
29-
github.com/docker/docker-credential-helpers v0.7.0 // indirect
25+
github.com/docker/cli v27.5.0+incompatible // indirect
26+
github.com/docker/distribution v2.8.3+incompatible // indirect
27+
github.com/docker/docker-credential-helpers v0.8.2 // indirect
3028
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
31-
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
32-
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
29+
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
30+
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
3331
github.com/fatih/structs v1.1.0 // indirect
34-
github.com/fsnotify/fsnotify v1.7.0 // indirect
35-
github.com/go-logr/logr v1.4.2 // indirect
32+
github.com/fsnotify/fsnotify v1.8.0 // indirect
33+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
34+
github.com/go-logr/logr v1.4.3 // indirect
3635
github.com/go-openapi/jsonpointer v0.21.0 // indirect
3736
github.com/go-openapi/jsonreference v0.21.0 // indirect
3837
github.com/go-openapi/swag v0.23.0 // indirect
3938
github.com/gogo/protobuf v1.3.2 // indirect
40-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4139
github.com/golang/protobuf v1.5.4 // indirect
42-
github.com/google/gnostic-models v0.6.8 // indirect
43-
github.com/google/go-cmp v0.6.0 // indirect
44-
github.com/google/go-containerregistry v0.19.1 // indirect
40+
github.com/google/btree v1.1.3 // indirect
41+
github.com/google/gnostic-models v0.6.9 // indirect
42+
github.com/google/go-cmp v0.7.0 // indirect
43+
github.com/google/go-containerregistry v0.20.3 // indirect
4544
github.com/google/gofuzz v1.2.0 // indirect
4645
github.com/google/uuid v1.6.0 // indirect
4746
github.com/huandu/xstrings v1.5.0 // indirect
48-
github.com/imdario/mergo v0.3.16 // indirect
47+
github.com/imdario/mergo v1.0.0 // indirect
4948
github.com/josharian/intern v1.0.0 // indirect
5049
github.com/json-iterator/go v1.1.12 // indirect
51-
github.com/klauspost/compress v1.17.2 // indirect
52-
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
53-
github.com/mailru/easyjson v0.7.7 // indirect
50+
github.com/klauspost/compress v1.18.0 // indirect
51+
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
52+
github.com/mailru/easyjson v0.9.0 // indirect
5453
github.com/mitchellh/copystructure v1.2.0 // indirect
5554
github.com/mitchellh/go-homedir v1.1.0 // indirect
5655
github.com/mitchellh/mapstructure v1.5.0 // indirect
5756
github.com/mitchellh/reflectwalk v1.0.2 // indirect
5857
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5958
github.com/modern-go/reflect2 v1.0.2 // indirect
6059
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
61-
github.com/nats-io/nkeys v0.4.7 // indirect
60+
github.com/nats-io/nkeys v0.4.11 // indirect
6261
github.com/nats-io/nuid v1.0.1 // indirect
62+
github.com/onsi/ginkgo/v2 v2.23.1 // indirect
6363
github.com/opencontainers/go-digest v1.0.0 // indirect
64-
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
64+
github.com/opencontainers/image-spec v1.1.0 // indirect
6565
github.com/pkg/errors v0.9.1 // indirect
6666
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
67-
github.com/prometheus/client_golang v1.18.0 // indirect
67+
github.com/prometheus/client_golang v1.20.5 // indirect
6868
github.com/prometheus/client_model v0.6.1 // indirect
69-
github.com/prometheus/common v0.46.0 // indirect
70-
github.com/prometheus/procfs v0.15.0 // indirect
71-
github.com/sergi/go-diff v1.2.0 // indirect
69+
github.com/prometheus/common v0.62.0 // indirect
70+
github.com/prometheus/procfs v0.15.1 // indirect
71+
github.com/rogpeppe/go-internal v1.13.1 // indirect
72+
github.com/sergi/go-diff v1.3.1 // indirect
7273
github.com/shopspring/decimal v1.4.0 // indirect
7374
github.com/sirupsen/logrus v1.9.3 // indirect
7475
github.com/spf13/cast v1.7.0 // indirect
75-
github.com/spf13/pflag v1.0.5 // indirect
76-
github.com/vbatts/tar-split v0.11.3 // indirect
76+
github.com/spf13/pflag v1.0.6 // indirect
77+
github.com/vbatts/tar-split v0.11.6 // indirect
78+
github.com/x448/float16 v0.8.4 // indirect
7779
github.com/yudai/gojsondiff v1.0.0 // indirect
7880
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
7981
github.com/zeebo/xxh3 v1.0.2 // indirect
80-
golang.org/x/crypto v0.27.0 // indirect
81-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
82-
golang.org/x/net v0.29.0 // indirect
83-
golang.org/x/oauth2 v0.22.0 // indirect
84-
golang.org/x/sync v0.8.0 // indirect
85-
golang.org/x/sys v0.25.0 // indirect
86-
golang.org/x/term v0.24.0 // indirect
87-
golang.org/x/text v0.18.0 // indirect
88-
golang.org/x/time v0.5.0 // indirect
89-
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
82+
golang.org/x/crypto v0.46.0 // indirect
83+
golang.org/x/net v0.47.0 // indirect
84+
golang.org/x/oauth2 v0.28.0 // indirect
85+
golang.org/x/sync v0.19.0 // indirect
86+
golang.org/x/sys v0.39.0 // indirect
87+
golang.org/x/term v0.38.0 // indirect
88+
golang.org/x/text v0.32.0 // indirect
89+
golang.org/x/time v0.11.0 // indirect
90+
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
9091
gomodules.xyz/pointer v0.1.0 // indirect
91-
google.golang.org/protobuf v1.34.2 // indirect
92+
google.golang.org/protobuf v1.36.6 // indirect
93+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
9294
gopkg.in/inf.v0 v0.9.1 // indirect
9395
gopkg.in/yaml.v2 v2.4.0 // indirect
9496
gopkg.in/yaml.v3 v3.0.1 // indirect
95-
k8s.io/api v0.30.2 // indirect
96-
k8s.io/apiextensions-apiserver v0.30.2 // indirect
97+
gotest.tools/v3 v3.5.1 // indirect
98+
k8s.io/api v0.32.8 // indirect
99+
k8s.io/apiextensions-apiserver v0.32.8 // indirect
97100
k8s.io/klog/v2 v2.130.1 // indirect
98-
k8s.io/kube-openapi v0.0.0-20240703190633-0aa61b46e8c2 // indirect
99-
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect
100-
kmodules.xyz/client-go v0.30.28 // indirect
101-
kmodules.xyz/go-containerregistry v0.0.12 // indirect
102-
kmodules.xyz/offshoot-api v0.30.1 // indirect
103-
kmodules.xyz/resource-metrics v0.30.4 // indirect
104-
sigs.k8s.io/controller-runtime v0.18.4 // indirect
105-
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
106-
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
101+
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
102+
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e // indirect
103+
kmodules.xyz/client-go v0.32.11 // indirect
104+
kmodules.xyz/go-containerregistry v0.0.14 // indirect
105+
kmodules.xyz/offshoot-api v0.32.0 // indirect
106+
kmodules.xyz/resource-metrics v0.30.12 // indirect
107+
sigs.k8s.io/controller-runtime v0.20.4 // indirect
108+
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
109+
sigs.k8s.io/randfill v1.0.0 // indirect
110+
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
107111
sigs.k8s.io/yaml v1.4.0 // indirect
108112
)
113+
114+
replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.6

0 commit comments

Comments
 (0)