wincred: inline label, and append to existing#433
Open
thaJeztah wants to merge 1 commit into
Open
Conversation
The code assumed that Attributes was always empty, so unconditionally replaced the attributes. Let's not assume that's the case (even if it is currently). Also inline the label for readability; we could optimize the byte-slice by making a package level variable, to avoid allocating, but that's probably not worth the optimzation. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Updates the Windows credential helper’s Add implementation to set the Docker “label” attribute in a slightly different way, intended to avoid overwriting any pre-existing credential attributes and to simplify the code.
Changes:
- Replace direct
g.Attributes = []...{...}assignment withappend(g.Attributes, ...). - Inline the
[]byte(credentials.CredsLabel)conversion into the attribute literal.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+23
to
+26
| g.Attributes = append(g.Attributes, winc.CredentialAttribute{ | ||
| Keyword: "label", | ||
| Value: []byte(credentials.CredsLabel), | ||
| }) |
Member
Author
There was a problem hiding this comment.
No, the main intent was to not assume winc.NewGenericCredential would always initialise with empty attributes. Currently that's the case, but we shouldn't assume that's the case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The code assumed that Attributes was always empty, so unconditionally replaced the attributes. Let's not assume that's the case (even if it is currently). Also inline the label for readability; we could optimize the byte-slice by making a package level variable, to avoid allocating, but that's probably not worth the optimzation.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)