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

fix(targets): make tag subcommand deny empty tags #453

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

StealthyCoder
Copy link
Member

This will not allow the user to potentially shoot themselves in the foot by denying potential empty tags list.

@StealthyCoder StealthyCoder requested a review from doanac February 10, 2025 18:33
@doanac doanac requested review from vkhoroz and removed request for doanac February 10, 2025 19:27
@doanac
Copy link
Member

doanac commented Feb 10, 2025

can you go ahead and add a separate commit to fix the CI issue? I know its not your problem but would be good to fix it while we are doing thins.

@@ -78,6 +78,8 @@ func doTag(cmd *cobra.Command, args []string) {
targetTags := tags
if tagAppend {
targetTags = Set(custom.Tags, tags)
} else if len(targetTags) == 0 {
subcommands.DieNotNil(fmt.Errorf("Cannot change tags from %s -> %s. Empty values are not allowed.", custom.Tags, targetTags))
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering why do we make this check here?
Wouldn't it be easier and better to check if len(tags) == 0 { errorOut } at line 60?
Or maybe just set something like the minlength in cobra argument definition?

Copy link
Member

@vkhoroz vkhoroz left a comment

Choose a reason for hiding this comment

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

LGTM

I'm sorry for that "artifitial build failure" from guthub.
What is you try to fix it separately, then merge and rebase this PR?

Anyway, do whatever takes less time. I'm totally fine with your fix for the topic.

@StealthyCoder StealthyCoder merged commit ee25370 into foundriesio:main Mar 13, 2025
8 checks passed
@StealthyCoder StealthyCoder deleted the fix/targets_tag branch March 13, 2025 12:45
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