Skip to content

Commit b9509d0

Browse files
Update golangci-lint to 1.49.0
Signed-off-by: killianmuldoon <[email protected]>
1 parent 6e30f66 commit b9509d0

File tree

18 files changed

+48
-38
lines changed

18 files changed

+48
-38
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ jobs:
2525
- name: golangci-lint
2626
uses: golangci/[email protected]
2727
with:
28-
version: v1.48.0
28+
version: v1.49.0
2929
working-directory: ${{matrix.working-directory}}

.golangci.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ linters:
44
- asciicheck
55
- bodyclose
66
- containedctx
7-
- deadcode
87
- depguard
98
- dogsled
109
- errcheck
@@ -19,7 +18,6 @@ linters:
1918
- gosec
2019
- gosimple
2120
- govet
22-
- ifshort
2321
- importas
2422
- ineffassign
2523
- misspell
@@ -32,14 +30,12 @@ linters:
3230
- revive
3331
- rowserrcheck
3432
- staticcheck
35-
- structcheck
3633
- stylecheck
3734
- thelper
3835
- typecheck
3936
- unconvert
4037
- unparam
4138
- unused
42-
- varcheck
4339
- whitespace
4440

4541
linters-settings:
@@ -51,9 +47,6 @@ linters-settings:
5147
exclude:
5248
- '^ \+.*'
5349
- '^ ANCHOR.*'
54-
ifshort:
55-
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
56-
max-decl-chars: 50
5750
gci:
5851
local-prefixes: "sigs.k8s.io/cluster-api"
5952
importas:
@@ -215,13 +208,7 @@ issues:
215208
- linters:
216209
- gocritic
217210
text: "appendAssign: append result not assigned to the same slice"
218-
# ifshort flags variables that are only used in the if-statement even though there is
219-
# already a SimpleStmt being used in the if-statement in question.
220-
- linters:
221-
- ifshort
222-
text: "variable .* is only used in the if-statement"
223-
path: controllers/mdutil/util.go
224-
# Disable linters for conversion
211+
# Disable linters for conversion
225212
- linters:
226213
- staticcheck
227214
text: "SA1019: in.(.+) is deprecated"
@@ -251,15 +238,6 @@ issues:
251238
- typecheck
252239
text: import (".+") is a program, not an importable package
253240
path: ^tools\.go$
254-
# TODO(sbueringer) Ignore ifshort false positive: https://github.com/esimonov/ifshort/issues/23
255-
- linters:
256-
- ifshort
257-
text: "variable 'isDeleteNodeAllowed' is only used in the if-statement.*"
258-
path: ^internal/controllers/machine/machine_controller\.go$
259-
- linters:
260-
- ifshort
261-
text: "variable 'kcpMachinesWithErrors' is only used in the if-statement.*"
262-
path: ^controlplane/kubeadm/internal/workload_cluster_conditions\.go$
263241
# We don't care about defer in for loops in test files.
264242
- linters:
265243
- gocritic

bootstrap/kubeadm/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// main is the main package for the Kubeadm Bootstrap provider.
1718
package main
1819

1920
import (
@@ -151,11 +152,13 @@ func main() {
151152

152153
// klog.Background will automatically use the right logger.
153154
ctrl.SetLogger(klog.Background())
154-
155155
if profilerAddress != "" {
156-
klog.Infof("Profiler listening for requests at %s", profilerAddress)
156+
setupLog.Info(fmt.Sprintf("Profiler listening for requests at %s", profilerAddress))
157157
go func() {
158-
klog.Info(http.ListenAndServe(profilerAddress, nil))
158+
srv := http.Server{Addr: profilerAddress, ReadHeaderTimeout: 2 * time.Second}
159+
if err := srv.ListenAndServe(); err != nil {
160+
setupLog.Error(err, "problem running profiler server")
161+
}
159162
}()
160163
}
161164

cmd/clusterctl/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// main is the main package for clusterctl.
1718
package main
1819

1920
import (

controlplane/kubeadm/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// main is the main package for the Kubeadm Control Plane provider.
1718
package main
1819

1920
import (
@@ -156,9 +157,12 @@ func main() {
156157
ctrl.SetLogger(klog.Background())
157158

158159
if profilerAddress != "" {
159-
klog.Infof("Profiler listening for requests at %s", profilerAddress)
160+
setupLog.Info(fmt.Sprintf("Profiler listening for requests at %s", profilerAddress))
160161
go func() {
161-
klog.Info(http.ListenAndServe(profilerAddress, nil))
162+
srv := http.Server{Addr: profilerAddress, ReadHeaderTimeout: 2 * time.Second}
163+
if err := srv.ListenAndServe(); err != nil {
164+
setupLog.Error(err, "problem running profiler server")
165+
}
162166
}()
163167
}
164168

exp/runtime/server/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ func (s *Server) validateHandler(handler ExtensionHandler) error {
175175
}
176176

177177
// Get hook and handler request and response types.
178-
hookRequestType := hookFuncType.In(0) //nolint:ifshort
179-
hookResponseType := hookFuncType.In(1) //nolint:ifshort
178+
hookRequestType := hookFuncType.In(0)
179+
hookResponseType := hookFuncType.In(1)
180180
handlerContextType := handlerFuncType.In(0)
181181
handlerRequestType := handlerFuncType.In(1)
182182
handlerResponseType := handlerFuncType.In(2)

hack/tools/conversion-verifier/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ limitations under the License.
2222
// the type MUST have a Hub() method.
2323
// - For each type with multiple versions, that has a Hub() and storage version,
2424
// the type MUST have ConvertFrom() and ConvertTo() methods.
25+
26+
// main is the main package for the conversion-verifier.
2527
package main

hack/tools/log-push/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ See the License for the specific language governing permissions and
1717
limitations under the License.
1818
*/
1919

20+
// main is the main package for Log Push.
2021
package main
2122

2223
import (

hack/tools/mdbook/embed/embed.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ See the License for the specific language governing permissions and
1717
limitations under the License.
1818
*/
1919

20+
// main is the main package for mdbook-embed.
2021
package main
2122

2223
import (

hack/tools/mdbook/releaselink/releaselink.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ See the License for the specific language governing permissions and
1717
limitations under the License.
1818
*/
1919

20+
// main is the main package for mdbook-releaselink.
2021
package main
2122

2223
import (

0 commit comments

Comments
 (0)