Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit 6428e48

Browse files
authored
Merge pull request #292 from m-messiah/upgrade-linter
🌱 Upgrade golangci-lint to v1.47.2 and fix its issues
2 parents 7ad275a + 23b650a commit 6428e48

File tree

24 files changed

+126
-19
lines changed

24 files changed

+126
-19
lines changed

.github/workflows/golangci-lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
go-version: 1.17
1919
- name: golangci-lint
20-
uses: golangci/golangci-lint-action@v3.1.0
20+
uses: golangci/golangci-lint-action@v3.2.0
2121
with:
22-
version: v1.44.0
22+
version: v1.47.2
2323
working-directory: ${{matrix.working-directory}}

virtualcluster/.golangci.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ linters:
1212
- gocritic
1313
- gocyclo
1414
- gofmt
15+
- goheader
1516
- goimports
1617
- goprintffuncname
1718
- gosec
@@ -56,6 +57,29 @@ linters-settings:
5657
# Controller Runtime
5758
- pkg: sigs.k8s.io/controller-runtime
5859
alias: ctrl
60+
goheader:
61+
values:
62+
const:
63+
AUTHOR: The Kubernetes Authors
64+
regexp:
65+
LICENSE_YEAR: 20\d\d
66+
SCHEME: http(s)?
67+
# The template use for checking.
68+
# Default: ""
69+
template: |-
70+
Copyright {{ LICENSE_YEAR }} {{ AUTHOR }}.
71+
72+
Licensed under the Apache License, Version 2.0 (the "License");
73+
you may not use this file except in compliance with the License.
74+
You may obtain a copy of the License at
75+
76+
{{ SCHEME }}://www.apache.org/licenses/LICENSE-2.0
77+
78+
Unless required by applicable law or agreed to in writing, software
79+
distributed under the License is distributed on an "AS IS" BASIS,
80+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81+
See the License for the specific language governing permissions and
82+
limitations under the License.
5983
6084
issues:
6185
max-same-issues: 0
@@ -120,7 +144,7 @@ issues:
120144
text: "appendAssign: append result not assigned to the same slice"
121145

122146
run:
123-
timeout: 10m
147+
timeout: 20m
124148
skip-files:
125149
- "zz_generated.*\\.go$"
126150
- ".*conversion.*\\.go$"

virtualcluster/cmd/vn-agent/app/server.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"net/http"
2424
"os"
25+
"time"
2526

2627
"k8s.io/apiserver/pkg/server/healthz"
2728

@@ -98,8 +99,9 @@ func Run(c *config.Config, serverOption *options.ServerOption, stopCh <-chan str
9899
}
99100

100101
s := &http.Server{
101-
Addr: fmt.Sprintf(":%d", serverOption.Port),
102-
Handler: handler,
102+
Addr: fmt.Sprintf(":%d", serverOption.Port),
103+
Handler: handler,
104+
ReadHeaderTimeout: time.Minute,
103105
TLSConfig: &tls.Config{
104106
ClientAuth: tls.RequestClientCert,
105107
MinVersion: tls.VersionTLS12,

virtualcluster/pkg/controller/controllers/metrics.go

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2022 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package controllers
218

319
import (

virtualcluster/pkg/controller/util/net/util.go

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2022 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package net
218

319
import (

virtualcluster/pkg/syncer/resources/configmap/checker.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
22
Copyright 2021 The Kubernetes Authors.
3-
Licensed under the Apache License, Version 2.0 (the "License");
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
67
7-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
89
910
Unless required by applicable law or agreed to in writing, software
1011
distributed under the License is distributed on an "AS IS" BASIS,

virtualcluster/pkg/syncer/resources/crd/checker.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2021 The Kubernetes Authors.
3-
Licensed under the Apache License, Version 2.0 (the "License");
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
6-
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/pkg/syncer/resources/crd/controller.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2021 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/pkg/syncer/resources/endpoints/checker.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
22
Copyright 2019 The Kubernetes Authors.
3-
Licensed under the Apache License, Version 2.0 (the "License");
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
67
7-
http://www.apache.org/licenses/LICENSE-2.0
8+
https://www.apache.org/licenses/LICENSE-2.0
89
910
Unless required by applicable law or agreed to in writing, software
1011
distributed under the License is distributed on an "AS IS" BASIS,

virtualcluster/pkg/syncer/resources/ingress/checker_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
6-
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/pkg/syncer/resources/namespace/checker.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
22
Copyright 2019 The Kubernetes Authors.
3-
Licensed under the Apache License, Version 2.0 (the "License");
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
67
7-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
89
910
Unless required by applicable law or agreed to in writing, software
1011
distributed under the License is distributed on an "AS IS" BASIS,

virtualcluster/pkg/syncer/resources/persistentvolume/checker_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/pkg/syncer/resources/pod/validationplugin/interface.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2022 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/pkg/syncer/resources/priorityclass/checker_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
6-
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/pkg/syncer/resources/service/checker_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/pkg/syncer/resources/serviceaccount/checker.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
22
Copyright 2019 The Kubernetes Authors.
3-
Licensed under the Apache License, Version 2.0 (the "License");
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
67
7-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
89
910
Unless required by applicable law or agreed to in writing, software
1011
distributed under the License is distributed on an "AS IS" BASIS,

virtualcluster/pkg/syncer/resources/serviceaccount/checker_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/pkg/syncer/resources/storageclass/checker_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/test/e2e/e2e.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/test/e2e/e2e_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
6-
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/test/e2e/framework/framework.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/test/e2e/framework/text_context.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/test/e2e/framework/util.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

virtualcluster/test/e2e/framework/vc.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
6-
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

0 commit comments

Comments
 (0)