Skip to content

Commit d242fe2

Browse files
authored
Merge pull request #1988 from sbueringer/pr-bump-golangci-lint
✨ Bump golangci lint to v1.49.0
2 parents 02dc464 + 4b208ab commit d242fe2

File tree

27 files changed

+187
-173
lines changed

27 files changed

+187
-173
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ jobs:
1919
- name: golangci-lint
2020
uses: golangci/golangci-lint-action@v2
2121
with:
22-
version: v1.47.3
22+
version: v1.49.0
2323
working-directory: ${{matrix.working-directory}}

.golangci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ linters:
1212
- goconst
1313
- gocritic
1414
- gocyclo
15-
- godot
1615
- gofmt
1716
- goimports
1817
- goprintffuncname
@@ -61,9 +60,9 @@ linters-settings:
6160
- pkg: sigs.k8s.io/controller-runtime
6261
alias: ctrl
6362
staticcheck:
64-
go: "1.18"
63+
go: "1.19"
6564
stylecheck:
66-
go: "1.18"
65+
go: "1.19"
6766
depguard:
6867
include-go-root: true
6968
packages:
@@ -132,6 +131,9 @@ issues:
132131
- linters:
133132
- gosec
134133
text: "G304: Potential file inclusion via variable"
134+
- linters:
135+
- revive
136+
text: "package-comments: should have a package comment"
135137

136138
run:
137139
timeout: 10m

doc.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ limitations under the License.
2323
// and uncommon cases should be possible. In general, controller-runtime tries
2424
// to guide users towards Kubernetes controller best-practices.
2525
//
26-
// Getting Started
26+
// # Getting Started
2727
//
2828
// The main entrypoint for controller-runtime is this root package, which
2929
// contains all of the common types needed to get started building controllers:
30-
// import (
31-
// ctrl "sigs.k8s.io/controller-runtime"
32-
// )
30+
//
31+
// import (
32+
// ctrl "sigs.k8s.io/controller-runtime"
33+
// )
3334
//
3435
// The examples in this package walk through a basic controller setup. The
3536
// kubebuilder book (https://book.kubebuilder.io) has some more in-depth
@@ -38,7 +39,7 @@ limitations under the License.
3839
// controller-runtime favors structs with sane defaults over constructors, so
3940
// it's fairly common to see structs being used directly in controller-runtime.
4041
//
41-
// Organization
42+
// # Organization
4243
//
4344
// A brief-ish walkthrough of the layout of this library can be found below. Each
4445
// package contains more information about how to use it.
@@ -47,7 +48,7 @@ limitations under the License.
4748
// controllers can be found at
4849
// https://github.com/kubernetes-sigs/controller-runtime/blob/master/FAQ.md.
4950
//
50-
// Managers
51+
// # Managers
5152
//
5253
// Every controller and webhook is ultimately run by a Manager (pkg/manager). A
5354
// manager is responsible for running controllers and webhooks, and setting up
@@ -56,7 +57,7 @@ limitations under the License.
5657
// generally configured to gracefully shut down controllers on pod termination
5758
// by wiring up a signal handler (pkg/manager/signals).
5859
//
59-
// Controllers
60+
// # Controllers
6061
//
6162
// Controllers (pkg/controller) use events (pkg/event) to eventually trigger
6263
// reconcile requests. They may be constructed manually, but are often
@@ -67,15 +68,15 @@ limitations under the License.
6768
// trigger reconciles. There are pre-written utilities for the common cases, and
6869
// interfaces and helpers for advanced cases.
6970
//
70-
// Reconcilers
71+
// # Reconcilers
7172
//
7273
// Controller logic is implemented in terms of Reconcilers (pkg/reconcile). A
7374
// Reconciler implements a function which takes a reconcile Request containing
7475
// the name and namespace of the object to reconcile, reconciles the object,
7576
// and returns a Response or an error indicating whether to requeue for a
7677
// second round of processing.
7778
//
78-
// Clients and Caches
79+
// # Clients and Caches
7980
//
8081
// Reconcilers use Clients (pkg/client) to access API objects. The default
8182
// client provided by the manager reads from a local shared cache (pkg/cache)
@@ -91,19 +92,19 @@ limitations under the License.
9192
// may retrieve event recorders (pkg/recorder) to emit events using the
9293
// manager.
9394
//
94-
// Schemes
95+
// # Schemes
9596
//
9697
// Clients, Caches, and many other things in Kubernetes use Schemes
9798
// (pkg/scheme) to associate Go types to Kubernetes API Kinds
9899
// (Group-Version-Kinds, to be specific).
99100
//
100-
// Webhooks
101+
// # Webhooks
101102
//
102103
// Similarly, webhooks (pkg/webhook/admission) may be implemented directly, but
103104
// are often constructed using a builder (pkg/webhook/admission/builder). They
104105
// are run via a server (pkg/webhook) which is managed by a Manager.
105106
//
106-
// Logging and Metrics
107+
// # Logging and Metrics
107108
//
108109
// Logging (pkg/log) in controller-runtime is done via structured logs, using a
109110
// log set of interfaces called logr
@@ -117,7 +118,7 @@ limitations under the License.
117118
// serve these by an HTTP endpoint, and additional metrics may be registered to
118119
// this Registry as normal.
119120
//
120-
// Testing
121+
// # Testing
121122
//
122123
// You can easily build integration and unit tests for your controllers and
123124
// webhooks using the test Environment (pkg/envtest). This will automatically

example_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ func Example() {
6464
// This application controller will be running leader election with the provided configuration in the manager options.
6565
// If leader election configuration is not provided, controller runs leader election with default values.
6666
// Default values taken from: https://github.com/kubernetes/component-base/blob/master/config/v1alpha1/defaults.go
67-
// defaultLeaseDuration = 15 * time.Second
68-
// defaultRenewDeadline = 10 * time.Second
69-
// defaultRetryPeriod = 2 * time.Second
67+
// * defaultLeaseDuration = 15 * time.Second
68+
// * defaultRenewDeadline = 10 * time.Second
69+
// * defaultRetryPeriod = 2 * time.Second
7070
//
7171
// * Create a new application for ReplicaSets that manages Pods owned by the ReplicaSet and calls into
7272
// ReplicaSetReconciler.

pkg/cache/cache.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ func New(config *rest.Config, opts Options) (Cache, error) {
170170
// BuilderWithOptions returns a Cache constructor that will build the a cache
171171
// honoring the options argument, this is useful to specify options like
172172
// SelectorsByObject
173-
// WARNING: if SelectorsByObject is specified. filtered out resources are not
174-
// returned.
175-
// WARNING: if UnsafeDisableDeepCopy is enabled, you must DeepCopy any object
176-
// returned from cache get/list before mutating it.
173+
// WARNING: If SelectorsByObject is specified, filtered out resources are not
174+
// returned.
175+
// WARNING: If UnsafeDisableDeepCopy is enabled, you must DeepCopy any object
176+
// returned from cache get/list before mutating it.
177177
func BuilderWithOptions(options Options) NewCacheFunc {
178178
return func(config *rest.Config, opts Options) (Cache, error) {
179179
if options.Scheme == nil {

pkg/client/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func init() {
4747
// It also applies saner defaults for QPS and burst based on the Kubernetes
4848
// controller manager defaults (20 QPS, 30 burst)
4949
//
50-
// Config precedence
50+
// Config precedence:
5151
//
5252
// * --kubeconfig flag pointing at a file
5353
//
@@ -67,7 +67,7 @@ func GetConfig() (*rest.Config, error) {
6767
// It also applies saner defaults for QPS and burst based on the Kubernetes
6868
// controller manager defaults (20 QPS, 30 burst)
6969
//
70-
// Config precedence
70+
// Config precedence:
7171
//
7272
// * --kubeconfig flag pointing at a file
7373
//

pkg/client/doc.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
// Package client contains functionality for interacting with Kubernetes API
1818
// servers.
1919
//
20-
// Clients
20+
// # Clients
2121
//
2222
// Clients are split into two interfaces -- Readers and Writers. Readers
2323
// get and list, while writers create, update, and delete.
@@ -29,14 +29,15 @@ limitations under the License.
2929
// server. This pattern is covered by the DelegatingClient type, which can
3030
// be used to have a client whose Reader is different from the Writer.
3131
//
32-
// Options
32+
// # Options
3333
//
3434
// Many client operations in Kubernetes support options. These options are
3535
// represented as variadic arguments at the end of a given method call.
3636
// For instance, to use a label selector on list, you can call
37-
// err := someReader.List(context.Background(), &podList, client.MatchingLabels{"somelabel": "someval"})
3837
//
39-
// Indexing
38+
// err := someReader.List(context.Background(), &podList, client.MatchingLabels{"somelabel": "someval"})
39+
//
40+
// # Indexing
4041
//
4142
// Indexes may be added to caches using a FieldIndexer. This allows you to easily
4243
// and efficiently look up objects with certain properties. You can then make

pkg/client/fake/doc.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ When in doubt, it's almost always better not to use this package and instead use
2828
envtest.Environment with a real client and API server.
2929
3030
WARNING: ⚠️ Current Limitations / Known Issues with the fake Client ⚠️
31-
- This client does not have a way to inject specific errors to test handled vs. unhandled errors.
32-
- There is some support for sub resources which can cause issues with tests if you're trying to update
33-
e.g. metadata and status in the same reconcile.
34-
- No OpenAPI validation is performed when creating or updating objects.
35-
- ObjectMeta's `Generation` and `ResourceVersion` don't behave properly, Patch or Update
36-
operations that rely on these fields will fail, or give false positives.
37-
31+
- This client does not have a way to inject specific errors to test handled vs. unhandled errors.
32+
- There is some support for sub resources which can cause issues with tests if you're trying to update
33+
e.g. metadata and status in the same reconcile.
34+
- No OpenAPI validation is performed when creating or updating objects.
35+
- ObjectMeta's `Generation` and `ResourceVersion` don't behave properly, Patch or Update
36+
operations that rely on these fields will fail, or give false positives.
3837
*/
3938
package fake

pkg/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ type DeferredFileLoader struct {
5050
// this will also configure the defaults for the loader if nothing is
5151
//
5252
// Defaults:
53-
// Path: "./config.yaml"
54-
// Kind: GenericControllerManagerConfiguration
53+
// * Path: "./config.yaml"
54+
// * Kind: GenericControllerManagerConfiguration
5555
func File() *DeferredFileLoader {
5656
scheme := runtime.NewScheme()
5757
utilruntime.Must(v1alpha1.AddToScheme(scheme))

pkg/config/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
// Package config contains functionality for interacting with ComponentConfig
1818
// files
1919
//
20-
// DeferredFileLoader
20+
// # DeferredFileLoader
2121
//
2222
// This uses a deferred file decoding allowing you to chain your configuration
2323
// setup. You can pass this into manager.Options#File and it will load your

0 commit comments

Comments
 (0)