Skip to content

Commit 55bafe5

Browse files
committed
improve builder deprecation messages
It's convention in the Go community that a function's deprecation notice is separated by a new paragraph from the function's documentation. Tools like staticcheck determine if a function has been deprecated by checking the beginning of new paragraphs. This changelist modifies the deprecation notices in the builder package to follow this convention, allowing linters like staticcheck, gometalinter, and golangci-lint to warn users of the package.
1 parent 6649bdb commit 55bafe5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/builder/build.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type Builder struct {
5050
}
5151

5252
// SimpleController returns a new Builder.
53+
//
5354
// Deprecated: Use ControllerManagedBy(Manager) instead.
5455
func SimpleController() *Builder {
5556
return &Builder{}
@@ -64,6 +65,7 @@ func ControllerManagedBy(m manager.Manager) *Builder {
6465
// update events by *reconciling the object*.
6566
// This is the equivalent of calling
6667
// Watches(&source.Kind{Type: apiType}, &handler.EnqueueRequestForObject{})
68+
//
6769
// Deprecated: Use For
6870
func (blder *Builder) ForType(apiType runtime.Object) *Builder {
6971
return blder.For(apiType)
@@ -99,13 +101,15 @@ func (blder *Builder) Watches(src source.Source, eventhandler handler.EventHandl
99101
}
100102

101103
// WithConfig sets the Config to use for configuring clients. Defaults to the in-cluster config or to ~/.kube/config.
104+
//
102105
// Deprecated: Use ControllerManagedBy(Manager) and this isn't needed.
103106
func (blder *Builder) WithConfig(config *rest.Config) *Builder {
104107
blder.config = config
105108
return blder
106109
}
107110

108111
// WithManager sets the Manager to use for registering the ControllerManagedBy. Defaults to a new manager.Manager.
112+
//
109113
// Deprecated: Use ControllerManagedBy(Manager) and this isn't needed.
110114
func (blder *Builder) WithManager(m manager.Manager) *Builder {
111115
blder.mgr = m
@@ -127,6 +131,7 @@ func (blder *Builder) Complete(r reconcile.Reconciler) error {
127131
}
128132

129133
// Build builds the Application ControllerManagedBy and returns the Manager used to start it.
134+
//
130135
// Deprecated: Use Complete
131136
func (blder *Builder) Build(r reconcile.Reconciler) (manager.Manager, error) {
132137
if r == nil {

0 commit comments

Comments
 (0)