Skip to content

Commit c386b63

Browse files
✨ re-enable golangci-lint's godoc comment checking
1 parent 85d4d48 commit c386b63

File tree

14 files changed

+87
-15
lines changed

14 files changed

+87
-15
lines changed

hack/lint2check/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module sigs.k8s.io/controller-runtime/hack/lint2check
22

3-
go 1.12
3+
go 1.13
44

5-
require github.com/google/go-github/v25 v25.1.1
5+
require github.com/google/go-github/v30 v30.1.0

hack/lint2check/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
2-
github.com/google/go-github/v25 v25.1.1 h1:6eW++i/CXcR5GKfYaaJT7oJJtHNU+/iiw55noEPNVao=
3-
github.com/google/go-github/v25 v25.1.1/go.mod h1:6z5pC69qHtrPJ0sXPsj4BLnd82b+r6sLB7qcBoRZqpw=
1+
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
2+
github.com/google/go-github/v30 v30.1.0 h1:VLDx+UolQICEOKu2m4uAoMti1SxuEBAl7RSEG16L+Oo=
3+
github.com/google/go-github/v30 v30.1.0/go.mod h1:n8jBpHl45a/rlBUtRJMOG4GhNADUQFEufcolZ95JfU8=
44
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
55
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
6+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
67
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
78
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
89
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
9-
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
1010
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
1111
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
1212
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=

hack/lint2check/lint2check.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"time"
2929
"fmt"
3030

31-
"github.com/google/go-github/v25/github"
31+
"github.com/google/go-github/v30/github"
3232
)
3333

3434
type lintResults struct {
@@ -247,10 +247,8 @@ func runLints(checkRun *github.CheckRun) error {
247247
} else {
248248
annot.StartLine = &issue.Pos.Line
249249
annot.EndLine = &issue.Pos.Line
250-
// TODO(directxman12): go-github doesn't support columns yet,
251-
// re-add this when they do
252-
// annot.StartColumn = &issue.Pos.Column
253-
// annot.EndColumn = &issue.Pos.Column
250+
annot.StartColumn = &issue.Pos.Column
251+
annot.EndColumn = &issue.Pos.Column
254252
}
255253

256254
annotations = append(annotations, annot)

pkg/builder/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,22 @@ func WithPredicates(predicates ...predicate.Predicate) Predicates {
5151
}
5252
}
5353

54+
// Predicates filters events before enqueuing the keys.
5455
type Predicates struct {
5556
predicates []predicate.Predicate
5657
}
5758

59+
// ApplyToFor applies this configuration to the given ForInput options.
5860
func (w Predicates) ApplyToFor(opts *ForInput) {
5961
opts.predicates = w.predicates
6062
}
63+
64+
// ApplyToOwns applies this configuration to the given OwnsInput options.
6165
func (w Predicates) ApplyToOwns(opts *OwnsInput) {
6266
opts.predicates = w.predicates
6367
}
68+
69+
// ApplyToWatches applies this configuration to the given WatchesInput options.
6470
func (w Predicates) ApplyToWatches(opts *WatchesInput) {
6571
opts.predicates = w.predicates
6672
}

pkg/builder/webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type WebhookBuilder struct {
3838
config *rest.Config
3939
}
4040

41+
// WebhookManagedBy allows inform its manager.Manager
4142
func WebhookManagedBy(m manager.Manager) *WebhookBuilder {
4243
return &WebhookBuilder{mgr: m}
4344
}

pkg/client/fake/doc.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ limitations under the License.
1515
*/
1616

1717
/*
18+
Package fake provides a fake client for testing.
19+
1820
Deprecated: please use pkg/envtest for testing. This package will be dropped
1921
before the v1.0.0 release.
20-
Package fake provides a fake client for testing.
2122
2223
An fake client is backed by its simple object store indexed by GroupVersionResource.
2324
You can create a fake client with optional objects.

pkg/client/options.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,40 @@ var DryRunAll = dryRunAll{}
7171

7272
type dryRunAll struct{}
7373

74+
// ApplyToCreate applies this configuration to the given create options.
7475
func (dryRunAll) ApplyToCreate(opts *CreateOptions) {
7576
opts.DryRun = []string{metav1.DryRunAll}
7677
}
78+
79+
// ApplyToUpdate applies this configuration to the given update options.
7780
func (dryRunAll) ApplyToUpdate(opts *UpdateOptions) {
7881
opts.DryRun = []string{metav1.DryRunAll}
7982
}
83+
84+
// ApplyToPatch applies this configuration to the given patch options.
8085
func (dryRunAll) ApplyToPatch(opts *PatchOptions) {
8186
opts.DryRun = []string{metav1.DryRunAll}
8287
}
88+
89+
// ApplyToPatch applies this configuration to the given delete options.
8390
func (dryRunAll) ApplyToDelete(opts *DeleteOptions) {
8491
opts.DryRun = []string{metav1.DryRunAll}
8592
}
8693

8794
// FieldOwner set the field manager name for the given server-side apply patch.
8895
type FieldOwner string
8996

97+
// ApplyToPatch applies this configuration to the given patch options.
9098
func (f FieldOwner) ApplyToPatch(opts *PatchOptions) {
9199
opts.FieldManager = string(f)
92100
}
101+
102+
// ApplyToCreate applies this configuration to the given create options.
93103
func (f FieldOwner) ApplyToCreate(opts *CreateOptions) {
94104
opts.FieldManager = string(f)
95105
}
106+
107+
// ApplyToUpdate applies this configuration to the given update options.
96108
func (f FieldOwner) ApplyToUpdate(opts *UpdateOptions) {
97109
opts.FieldManager = string(f)
98110
}
@@ -252,33 +264,49 @@ func (o *DeleteOptions) ApplyToDelete(do *DeleteOptions) {
252264
// to the given number of seconds.
253265
type GracePeriodSeconds int64
254266

267+
// ApplyToDelete applies this configuration to the given delete options.
255268
func (s GracePeriodSeconds) ApplyToDelete(opts *DeleteOptions) {
256269
secs := int64(s)
257270
opts.GracePeriodSeconds = &secs
258271
}
259272

273+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
260274
func (s GracePeriodSeconds) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
261275
s.ApplyToDelete(&opts.DeleteOptions)
262276
}
263277

278+
// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
264279
type Preconditions metav1.Preconditions
265280

281+
// ApplyToDelete applies this configuration to the given delete options.
266282
func (p Preconditions) ApplyToDelete(opts *DeleteOptions) {
267283
preconds := metav1.Preconditions(p)
268284
opts.Preconditions = &preconds
269285
}
270286

287+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
271288
func (p Preconditions) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
272289
p.ApplyToDelete(&opts.DeleteOptions)
273290
}
274291

292+
// PropagationPolicy determined whether and how garbage collection will be
293+
// performed. Either this field or OrphanDependents may be set, but not both.
294+
// The default policy is decided by the existing finalizer set in the
295+
// metadata.finalizers and the resource-specific default policy.
296+
// Acceptable values are: 'Orphan' - orphan the dependents; 'Background' -
297+
// allow the garbage collector to delete the dependents in the background;
298+
// 'Foreground' - a cascading policy that deletes all dependents in the
299+
// foreground.
275300
type PropagationPolicy metav1.DeletionPropagation
276301

302+
// ApplyToDelete applies the given delete options on these options.
303+
// It will propagate to the dependents of the object to let the garbage collector handle it.
277304
func (p PropagationPolicy) ApplyToDelete(opts *DeleteOptions) {
278305
policy := metav1.DeletionPropagation(p)
279306
opts.PropagationPolicy = &policy
280307
}
281308

309+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
282310
func (p PropagationPolicy) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
283311
p.ApplyToDelete(&opts.DeleteOptions)
284312
}
@@ -379,12 +407,14 @@ func (o *ListOptions) ApplyOptions(opts []ListOption) *ListOptions {
379407
// MatchingLabels filters the list/delete operation on the given set of labels.
380408
type MatchingLabels map[string]string
381409

410+
// ApplyToList applies this configuration to the given list options.
382411
func (m MatchingLabels) ApplyToList(opts *ListOptions) {
383412
// TODO(directxman12): can we avoid reserializing this over and over?
384413
sel := labels.SelectorFromValidatedSet(map[string]string(m))
385414
opts.LabelSelector = sel
386415
}
387416

417+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
388418
func (m MatchingLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
389419
m.ApplyToList(&opts.ListOptions)
390420
}
@@ -393,6 +423,7 @@ func (m MatchingLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
393423
// without checking their values.
394424
type HasLabels []string
395425

426+
// ApplyToList applies this configuration to the given list options.
396427
func (m HasLabels) ApplyToList(opts *ListOptions) {
397428
sel := labels.NewSelector()
398429
for _, label := range m {
@@ -404,6 +435,7 @@ func (m HasLabels) ApplyToList(opts *ListOptions) {
404435
opts.LabelSelector = sel
405436
}
406437

438+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
407439
func (m HasLabels) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
408440
m.ApplyToList(&opts.ListOptions)
409441
}
@@ -415,10 +447,12 @@ type MatchingLabelsSelector struct {
415447
labels.Selector
416448
}
417449

450+
// ApplyToList applies this configuration to the given list options.
418451
func (m MatchingLabelsSelector) ApplyToList(opts *ListOptions) {
419452
opts.LabelSelector = m
420453
}
421454

455+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
422456
func (m MatchingLabelsSelector) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
423457
m.ApplyToList(&opts.ListOptions)
424458
}
@@ -435,12 +469,14 @@ func MatchingField(name, val string) MatchingFields {
435469
// (or index in the case of cached lists).
436470
type MatchingFields fields.Set
437471

472+
// ApplyToList applies this configuration to the given list options.
438473
func (m MatchingFields) ApplyToList(opts *ListOptions) {
439474
// TODO(directxman12): can we avoid re-serializing this?
440475
sel := fields.Set(m).AsSelector()
441476
opts.FieldSelector = sel
442477
}
443478

479+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
444480
func (m MatchingFields) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
445481
m.ApplyToList(&opts.ListOptions)
446482
}
@@ -452,21 +488,25 @@ type MatchingFieldsSelector struct {
452488
fields.Selector
453489
}
454490

491+
// ApplyToList applies this configuration to the given list options.
455492
func (m MatchingFieldsSelector) ApplyToList(opts *ListOptions) {
456493
opts.FieldSelector = m
457494
}
458495

496+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
459497
func (m MatchingFieldsSelector) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
460498
m.ApplyToList(&opts.ListOptions)
461499
}
462500

463501
// InNamespace restricts the list/delete operation to the given namespace.
464502
type InNamespace string
465503

504+
// ApplyToList applies this configuration to the given list options.
466505
func (n InNamespace) ApplyToList(opts *ListOptions) {
467506
opts.Namespace = string(n)
468507
}
469508

509+
// ApplyToDeleteAllOf applies this configuration to the given an List options.
470510
func (n InNamespace) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
471511
n.ApplyToList(&opts.ListOptions)
472512
}
@@ -476,6 +516,7 @@ func (n InNamespace) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
476516
// does not support setting it for deletecollection operations.
477517
type Limit int64
478518

519+
// ApplyToList applies this configuration to the given an list options.
479520
func (l Limit) ApplyToList(opts *ListOptions) {
480521
opts.Limit = int64(l)
481522
}
@@ -485,6 +526,7 @@ func (l Limit) ApplyToList(opts *ListOptions) {
485526
// does not support setting it for deletecollection operations.
486527
type Continue string
487528

529+
// ApplyToList applies this configuration to the given an List options.
488530
func (c Continue) ApplyToList(opts *ListOptions) {
489531
opts.Continue = string(c)
490532
}

pkg/controller/controllertest/unconventionallisttypecrd.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ func (u *UnconventionalListType) DeepCopyObject() runtime.Object {
2222
return u.DeepCopy()
2323
}
2424

25+
// DeepCopy implements *UnconventionalListType
26+
// Handwritten for simplicity.
2527
func (u *UnconventionalListType) DeepCopy() *UnconventionalListType {
2628
return &UnconventionalListType{
2729
TypeMeta: u.TypeMeta,
@@ -44,6 +46,8 @@ func (u *UnconventionalListTypeList) DeepCopyObject() runtime.Object {
4446
return u.DeepCopy()
4547
}
4648

49+
// DeepCopy implements *UnconventionalListTypeListt
50+
// Handwritten for simplicity.
4751
func (u *UnconventionalListTypeList) DeepCopy() *UnconventionalListTypeList {
4852
out := &UnconventionalListTypeList{
4953
TypeMeta: u.TypeMeta,

pkg/internal/testing/integration/internal/apiserver.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package internal
22

3+
// APIServerDefaultArgs allow tests to run offline, by preventing API server from attempting to
4+
// use default route to determine its --advertise-address.
35
var APIServerDefaultArgs = []string{
4-
// Allow tests to run offline, by preventing API server from attempting to
5-
// use default route to determine its --advertise-address
66
"--advertise-address=127.0.0.1",
77
"--etcd-servers={{ if .EtcdURL }}{{ .EtcdURL.String }}{{ end }}",
88
"--cert-dir={{ .CertDir }}",
@@ -14,6 +14,8 @@ var APIServerDefaultArgs = []string{
1414
"--allow-privileged=true",
1515
}
1616

17+
// DoAPIServerArgDefaulting will set default values to allow tests to run offline when the args are not informed. Otherwise,
18+
// it will return the same []string arg passed as param.
1719
func DoAPIServerArgDefaulting(args []string) []string {
1820
if len(args) != 0 {
1921
return args

pkg/internal/testing/integration/internal/arguments.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"html/template"
66
)
77

8+
// RenderTemplates returns an []string to render the templates
89
func RenderTemplates(argTemplates []string, data interface{}) (args []string, err error) {
910
var t *template.Template
1011

pkg/internal/testing/integration/internal/etcd.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ import (
44
"net/url"
55
)
66

7+
// EtcdDefaultArgs allow tests to run offline, by preventing API server from attempting to
8+
// use default route to determine its urls.
79
var EtcdDefaultArgs = []string{
810
"--listen-peer-urls=http://localhost:0",
911
"--advertise-client-urls={{ if .URL }}{{ .URL.String }}{{ end }}",
1012
"--listen-client-urls={{ if .URL }}{{ .URL.String }}{{ end }}",
1113
"--data-dir={{ .DataDir }}",
1214
}
1315

16+
// DoEtcdArgDefaulting will set default values to allow tests to run offline when the args are not informed. Otherwise,
17+
// it will return the same []string arg passed as param.
1418
func DoEtcdArgDefaulting(args []string) []string {
1519
if len(args) != 0 {
1620
return args
@@ -19,6 +23,7 @@ func DoEtcdArgDefaulting(args []string) []string {
1923
return EtcdDefaultArgs
2024
}
2125

26+
// isSecureScheme returns false when the schema is insecure.
2227
func isSecureScheme(scheme string) bool {
2328
// https://github.com/coreos/etcd/blob/d9deeff49a080a88c982d328ad9d33f26d1ad7b6/pkg/transport/listener.go#L53
2429
if scheme == "https" || scheme == "unixs" {
@@ -27,6 +32,8 @@ func isSecureScheme(scheme string) bool {
2732
return false
2833
}
2934

35+
// GetEtcdStartMessage returns an start message to inform if the client is or not insecure.
36+
// It will return true when the URL informed has the scheme == "https" || scheme == "unixs"
3037
func GetEtcdStartMessage(listenURL url.URL) string {
3138
if isSecureScheme(listenURL.Scheme) {
3239
// https://github.com/coreos/etcd/blob/a7f1fbe00ec216fcb3a1919397a103b41dca8413/embed/serve.go#L167

pkg/internal/testing/integration/internal/integration_tests/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Package integrariontests is holding the integration tests to run against the
2+
Package integrationtests holds the integration tests to run against the
33
framework.
44
55
This file's only purpose is to make godep happy.

0 commit comments

Comments
 (0)