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

Switch to dot as resource separator #163

Merged
merged 5 commits into from
Sep 23, 2021

Conversation

malcolmholmes
Copy link
Contributor

I mistakenly assumed that a dot was a special character in globs. It isn't - a single character glob is a question mark.

Therefore, we can revert to using dots as separators everywhere. This PR does that, but it also keeps slash separators working for command line targets.

Copy link
Contributor

@dsotirakis dsotirakis left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@samjewell samjewell left a comment

Choose a reason for hiding this comment

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

Very nice, thanks for this change 💯

Comment on lines 140 to 141
slashKey := fmt.Sprintf("%s/%s", r.Kind(), UID)
dotKey := fmt.Sprintf("%s.%s", r.Kind(), UID)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be tempted to use the following here, to have less duplication and fewer sources of truth:

Suggested change
slashKey := fmt.Sprintf("%s/%s", r.Kind(), UID)
dotKey := fmt.Sprintf("%s.%s", r.Kind(), UID)
dotKey := r.Key() // fmt.Sprintf("%s.%s", r.Kind(), UID)
slashKey := fmt.Sprintf("%s/%s", r.Kind(), UID)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 58 to 62
// Key returns a key that combines kind and uid
func (r *Resource) Key() string {
uid := r.UID()
return fmt.Sprintf("%s.%s", r.Kind(), uid)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be nice to define the .Key method before the .UID() method, so that the file reads from higher-level methods to lower level ones. Similar to the description on this post.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@malcolmholmes malcolmholmes merged commit 1f8517b into master Sep 23, 2021
@samjewell samjewell deleted the malcolmholmes/switch-to-dots branch September 23, 2021 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants