Skip to content

Commit 865cb51

Browse files
authored
chore(ci): lint vet (#860)
* chore(ci): web lint * chore(ci): go lint vet * f * f * f * f * f * f * f * f
1 parent 9524312 commit 865cb51

File tree

17 files changed

+310
-266
lines changed

17 files changed

+310
-266
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ updates:
3434
security:
3535
update-types:
3636
- "patch"
37+
babel:
38+
patterns:
39+
- "@babel/*"
3740

3841
- package-ecosystem: "github-actions"
3942
directory: "/"

.github/workflows/build-test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
3737
shell: bash
3838

39-
- run: make -C tgapi test
39+
- run: make -C tgapi lint vet test
4040

4141
test-tgrun:
4242
runs-on: ubuntu-latest
@@ -53,19 +53,19 @@ jobs:
5353
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
5454
shell: bash
5555

56-
- run: make -C tgrun test
56+
- run: make -C tgrun lint vet test
5757

5858
build-web:
5959
runs-on: ubuntu-latest
6060
needs: validate-go-mod
6161
steps:
62+
- uses: actions/checkout@v4
63+
6264
- uses: actions/setup-node@v4
6365
with:
64-
node-version: '14'
65-
66-
- uses: actions/checkout@v4
66+
node-version-file: .nvmrc
6767

68-
- run: make -C web deps build-staging
68+
- run: make -C web deps lint build-staging
6969

7070
docker-image-tgapi:
7171
runs-on: ubuntu-latest

.golangci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: "2"
2+
linters:
3+
default: none
4+
enable:
5+
- govet
6+
- ineffassign
7+
- nolintlint
8+
- staticcheck
9+
settings:
10+
govet:
11+
enable:
12+
- nilness
13+
- reflectvaluecompare
14+
- sortslice
15+
- unusedwrite
16+
unused:
17+
field-writes-are-uses: false
18+
exported-fields-are-used: false
19+
local-variables-are-used: false
20+
exclusions:
21+
generated: lax
22+
paths:
23+
- third_party$
24+
- builtin$
25+
- examples$
26+
issues:
27+
max-issues-per-linter: 0
28+
max-same-issues: 0
29+
formatters:
30+
enable:
31+
- gofmt
32+
exclusions:
33+
generated: lax
34+
paths:
35+
- third_party$
36+
- builtin$
37+
- examples$

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14
1+
22

tgapi/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ fmt:
99

1010
.PHONY: lint
1111
lint:
12-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
13-
golangci-lint run --enable-all ./...
12+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
13+
golangci-lint run ./...
1414

1515
.PHONY: vet
1616
vet:

tgapi/pkg/cli/api/run.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ func RunCmd() *cobra.Command {
2727
viper.BindPFlags(cmd.Flags())
2828
},
2929
RunE: func(cmd *cobra.Command, args []string) error {
30-
rand.Seed(time.Now().UnixNano())
31-
3230
rRoot := mux.NewRouter()
3331
rRoot.Use(mux.CORSMethodMiddleware(rRoot))
3432

tgapi/pkg/persistence/statsd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ func getInstancePrivateIP(cfg aws.Config) (string, error) {
7272
if err != nil {
7373
return "", err
7474
}
75-
return result.InstanceIdentityDocument.PrivateIP, nil
75+
return result.PrivateIP, nil
7676
}

tgrun/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ fmt:
1111

1212
.PHONY: lint
1313
lint:
14-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
15-
golangci-lint run --enable-all ./...
14+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
15+
golangci-lint run ./...
1616

1717
.PHONY: vet
1818
vet:

tgrun/pkg/runner/cleanup.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func cleanupPVCs(clientset *kubernetes.Clientset) error {
159159
for _, pvc := range pvcs.Items {
160160
// clean pvc older timeoutAfterMinutes+10 minutes
161161
if time.Since(pvc.CreationTimestamp.Time).Minutes() > timeoutAfterMinutes+10 {
162-
pvc.ObjectMeta.SetFinalizers(nil)
162+
pvc.SetFinalizers(nil)
163163
p, err := clientset.CoreV1().PersistentVolumeClaims(Namespace).Update(context.TODO(), &pvc, metav1.UpdateOptions{})
164164
if err != nil {
165165
fmt.Printf("Failed removing finalizers for pvc %s; EROOR: %s\n", p.Name, err)
@@ -188,7 +188,7 @@ func cleanupPVs(clientset *kubernetes.Clientset) error {
188188
for _, pv := range pvs.Items {
189189
localPath := pv.Spec.Local.Path
190190
// deleting PVs older than timeoutAfterMinutes+20 minutes
191-
if time.Since(pv.CreationTimestamp.Time).Minutes() > timeoutAfterMinutes+20 && pv.ObjectMeta.DeletionTimestamp == nil {
191+
if time.Since(pv.CreationTimestamp.Time).Minutes() > timeoutAfterMinutes+20 && pv.DeletionTimestamp == nil {
192192
err := clientset.CoreV1().PersistentVolumes().Delete(context.TODO(), pv.Name, metav1.DeleteOptions{})
193193
if err != nil {
194194
fmt.Printf("Failed to delete pv %s; ERROR: %s\n", pv.Name, err)
@@ -202,9 +202,9 @@ func cleanupPVs(clientset *kubernetes.Clientset) error {
202202
if err != nil {
203203
fmt.Printf("Failed to delete %s; ERROR: %s\n", localPath, err)
204204
}
205-
} else if pv.ObjectMeta.DeletionTimestamp != nil {
205+
} else if pv.DeletionTimestamp != nil {
206206
// cleaning pv stack in Terminating state
207-
pv.ObjectMeta.SetFinalizers(nil)
207+
pv.SetFinalizers(nil)
208208
p, err := clientset.CoreV1().PersistentVolumes().Update(context.TODO(), &pv, metav1.UpdateOptions{})
209209
if err != nil {
210210
fmt.Printf("Failed removing finalizers for pv %s; EROOR: %s\n", p.Name, err)

tgrun/pkg/scheduler/generate.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,46 @@ var kubernetesVersions = []string{
66
}
77

88
var cri = map[string][]string{
9-
"docker": []string{
9+
"docker": {
1010
"19.03.4",
1111
// "18.09.8",
1212
},
1313
}
1414

1515
var cni = map[string][]string{
16-
"weave": []string{
16+
"weave": {
1717
"1.0.4",
1818
},
19-
// "calico": []string{
19+
// "calico": {
2020
// "3.9.1",
2121
// },
2222
}
2323

2424
var addOnsWithVersions = map[string][]string{
25-
// "aws": []string{
25+
// "aws": {
2626
// // "0.0.1",
2727
// },
28-
"contour": []string{
28+
"contour": {
2929
"1.0.1",
3030
// "0.14.0",
3131
},
32-
"ekco": []string{
32+
"ekco": {
3333
"0.2.4",
3434
// "0.2.3",
3535
// "0.2.2",
3636
// "0.2.1",
3737
// "0.1.0",
3838
},
39-
// "fluentd": []string{
39+
// "fluentd": {
4040
// "1.7.4",
4141
// },
42-
"rook": []string{
42+
"rook": {
4343
"1.0.4",
4444
},
45-
"prometheus": []string{
45+
"prometheus": {
4646
"0.33.0",
4747
},
48-
"kotsadm": []string{
48+
"kotsadm": {
4949
"1.16.0",
5050
// "1.15.5",
5151
// "1.15.4",
@@ -54,17 +54,17 @@ var addOnsWithVersions = map[string][]string{
5454
// "1.15.1",
5555
// "1.15.0",
5656
},
57-
"minio": []string{
57+
"minio": {
5858
"2020-01-25T02-50-51Z",
5959
},
60-
// "nodeless": []string{},
61-
// "openebs": []string{
60+
// "nodeless": {},
61+
// "openebs": {
6262
// "1.6.0",
6363
// },
64-
"registry": []string{
64+
"registry": {
6565
"2.7.1",
6666
},
67-
"velero": []string{
67+
"velero": {
6868
"1.2.0",
6969
},
7070
}

0 commit comments

Comments
 (0)