-
Notifications
You must be signed in to change notification settings - Fork 66
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this 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 💯
pkg/grizzly/providers.go
Outdated
slashKey := fmt.Sprintf("%s/%s", r.Kind(), UID) | ||
dotKey := fmt.Sprintf("%s.%s", r.Kind(), UID) |
There was a problem hiding this comment.
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:
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/grizzly/providers.go
Outdated
// 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) | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.