Skip to content

wincred: inline label, and append to existing#433

Open
thaJeztah wants to merge 1 commit into
docker:mainfrom
thaJeztah:wincred_inline
Open

wincred: inline label, and append to existing#433
thaJeztah wants to merge 1 commit into
docker:mainfrom
thaJeztah:wincred_inline

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

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)

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-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 with append(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 thread wincred/wincred.go
Comment on lines +23 to +26
g.Attributes = append(g.Attributes, winc.CredentialAttribute{
Keyword: "label",
Value: []byte(credentials.CredsLabel),
})
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

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