Skip to content

Commit

Permalink
improve builder deprecation messages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
terinjokes committed Mar 7, 2019
1 parent 6649bdb commit cd52b04
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type Builder struct {
}

// SimpleController returns a new Builder.
//
// Deprecated: Use ControllerManagedBy(Manager) instead.
func SimpleController() *Builder {
return &Builder{}
Expand All @@ -64,6 +65,7 @@ func ControllerManagedBy(m manager.Manager) *Builder {
// update events by *reconciling the object*.
// This is the equivalent of calling
// Watches(&source.Kind{Type: apiType}, &handler.EnqueueRequestForObject{})
//
// Deprecated: Use For
func (blder *Builder) ForType(apiType runtime.Object) *Builder {
return blder.For(apiType)
Expand Down Expand Up @@ -99,13 +101,15 @@ func (blder *Builder) Watches(src source.Source, eventhandler handler.EventHandl
}

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

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

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

0 comments on commit cd52b04

Please sign in to comment.