Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove constructor interface #652

Merged
merged 2 commits into from
Apr 13, 2018

Conversation

grantr
Copy link
Contributor

@grantr grantr commented Apr 13, 2018

Implements the suggestion from #635 (review). @johnugeorge this should unblock #635.

Proposed Changes

We'd like to move command flags into the cmd package so controller code isn't aware of flag parsing, which means constructor signatures need to be updated to allow flag values to be passed in. This requires removing the Constructor interface to allow constructor signatures to vary depending on which flags are relevant to each controller.

The original idea was that a constructor interface was useful because we'd be adding lots of controllers, but it turned out adding a controller is a rare occurrence.

I also slipped in a variable rename to avoid a go vet warning about shadowed err. This is in a separate commit.

Release Note

NONE

We'd like to move command flags into the cmd package so controller code isn't
aware of flag parsing, which means constructor signatures need to be updated to
allow flag values to be passed in. This requires removing the Constructor
interface to allow constructor signatures to vary depending on which flags are
relevant to each controller.

The original idea was that a constructor interface was useful because we'd be
adding lots of controllers, but it turned out adding a controller is a rare
occurrence.
go vet says this shadows the outer err, which is practically not an issue but
we'd like go vet to be green.
@google-prow-robot google-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 13, 2018
@mattmoor
Copy link
Member

/approve
/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 13, 2018
@google-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grantr, mattmoor

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-prow-robot google-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 13, 2018
@steuhs
Copy link
Contributor

steuhs commented Apr 13, 2018

/retest

@johnugeorge
Copy link
Contributor

LGTM

@grantr
Copy link
Contributor Author

grantr commented Apr 13, 2018

Guessing this is delayed due to #543. Since it's blocking #635, I'm going to merge manually.

@grantr grantr merged commit 2e4319f into knative:master Apr 13, 2018
@grantr grantr deleted the remove-constructor-interface branch April 13, 2018 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants