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

Default index function #668

Merged

Conversation

chriskim06
Copy link
Member

Adding this based on the comment here #666 (comment). This reverts back constants.go so that it only has the constant values and adds a pkg/index/util.go that has the DefaultIndex function in it.

/assign @ahmetb
/assign @corneliusweig

Related issue: #637

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 24, 2020
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 24, 2020
Copy link
Contributor

@corneliusweig corneliusweig left a comment

Choose a reason for hiding this comment

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

This is the right call to make constants really constant.

Looks all good, but you might want to adjust the date :)
/lgtm
/approve
/hold

pkg/index/util.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 24, 2020
Co-authored-by: Cornelius Weig <22861411+corneliusweig@users.noreply.github.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 24, 2020
"sigs.k8s.io/krew/pkg/constants"
)

func DefaultIndex() string {
Copy link
Member

Choose a reason for hiding this comment

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

a mini unit-test would be great for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

for sure, I'll add that in

@ahmetb
Copy link
Member

ahmetb commented Nov 24, 2020

/approve

I'm now thinking if this option is worth documenting somewhere. We have other options like $KREW_ROOT that also are not documented, maybe in the future.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, chriskim06, corneliusweig

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:
  • OWNERS [ahmetb,corneliusweig]

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

@chriskim06
Copy link
Member Author

I was planning on adding the docs in a separate PR but if you guys think we don't need it for now I can get to it later on

Copy link
Contributor

@corneliusweig corneliusweig left a comment

Choose a reason for hiding this comment

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

If you don't forget about it, you can add the docs later. But we are in no hurry with this and it is far less useful while not documented.


func TestDefaultIndex(t *testing.T) {
if got := DefaultIndex(); got != constants.DefaultIndexURI {
t.Errorf("expected DefaultIndex() to be %q; got=%q", constants.DefaultIndexURI, got)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
t.Errorf("expected DefaultIndex() to be %q; got=%q", constants.DefaultIndexURI, got)
t.Errorf("DefaultIndex() = %q, want %q", got, constants.DefaultIndexURI)

Same below.

@corneliusweig
Copy link
Contributor

/lgtm
Release the hold of you want to do the documentation in a separate PR.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 25, 2020
@chriskim06
Copy link
Member Author

Ya I'd like to do them in a separate PR, I'll be able to submit that PR this weekend.

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 25, 2020
@k8s-ci-robot k8s-ci-robot merged commit 9749c9e into kubernetes-sigs:master Nov 25, 2020
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants