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

Making a toReference public to enable reuse from kn-plugins #1203

Merged
merged 4 commits into from
Jan 26, 2021

Conversation

cardil
Copy link
Contributor

@cardil cardil commented Jan 25, 2021

Description

Moving a toReference to a public package, so that is it possible to invoke it, from kn plugins.

Changes

  • Move toReference function to knative.dev/client/pkg/util.ToTrackerReference
  • Move parseSelector function to knative.dev/client/pkg/util.ParseSelector

Reference

Fixes #1202

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jan 25, 2021
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cardil: 0 warnings.

In response to this:

Description

Moving a toReference to a public package, so that is it possible to invoke it, from kn plugins.

Changes

  • Move toReference function to knative.dev/client/pkg/util.ToTrackerReference
  • Move parseSelector function to knative.dev/client/pkg/util.ParseSelector

Reference

Fixes #1202

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 25, 2021
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/commands/source/binding/binding.go 57.4% 50.0% -7.4
pkg/util/parsing_helper.go 86.8% 90.7% 3.9

@cardil
Copy link
Contributor Author

cardil commented Jan 25, 2021

/retest

Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea and we definitely have every more functions to expose for plugins. However, we had discussed to move all these to the lib/* directory instead of leaving them in the pkg/* So perhaps it makes sense to create a lib/util package and move things there? WDYT?

@cardil
Copy link
Contributor Author

cardil commented Jan 25, 2021

IDT, if I'm on board with such move. It seems to me like an affront to Golang standards. pkg directory is a Golang standard for code for external use - see: https://github.com/golang-standards/project-layout#pkg

Library code that's ok to use by external applications (e.g., /pkg/mypubliclib)

Internal code should be placed in internal directory.

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me ! We might move this code again later when we do a larger refactoring of shared code though, but for now this is fine for me.

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 26, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cardil, rhuss

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 26, 2021
@knative-prow-robot knative-prow-robot merged commit 605e40a into knative:master Jan 26, 2021
@rhuss
Copy link
Contributor

rhuss commented Jan 26, 2021

IDT, if I'm on board with such move. It seems to me like an affront to Golang standards. pkg directory is a Golang standard for code for external use - see: https://github.com/golang-standards/project-layout#pkg

Then we did it all wrong until know as we definitely added for-internal-use-only code into this package already. Thanks for the heads up though, we will take the golang recommendations into account when we move around the code into a shared repository.

In order to unblock your work, let's merge this PR and fix that later with the bigger move.

@cardil cardil deleted the feature/public-to-reference branch January 28, 2021 13:51
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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to use toReference method from outside, in ex. kn plugins
5 participants