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

[Go 1.18] Introduce type parameters #2034

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

dominikschulz
Copy link
Member

This commit replaces some overly complex constructs with type
parameters.

Fixes #2030

RELEASE_NOTES=[ENHANCEMENT] Generics

Signed-off-by: Dominik Schulz dominik.schulz@gauner.org

@dominikschulz dominikschulz force-pushed the fix/issue-2030 branch 2 times, most recently from 9e8803f to 49d56d5 Compare December 21, 2021 09:06
@dominikschulz dominikschulz marked this pull request as ready for review December 21, 2021 09:06
@dominikschulz dominikschulz force-pushed the fix/issue-2030 branch 3 times, most recently from 527656e to ca4b9c4 Compare December 21, 2021 09:37
AnomalRoil
AnomalRoil previously approved these changes Dec 21, 2021
Copy link
Member

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

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

Nothing special to say, I'm yet to get used to Generics, but LGTM

Comment on lines +69 to +77
bes := make([]V, 0, len(r.backends))
for _, be := range r.backends {
bes = append(bes, be)
}
Copy link
Member

Choose a reason for hiding this comment

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

Looking forward the new maps package in 1.19 for that :)

Comment on lines +88 to +95
if name == "gpg" {
name = "gpgcli"
}
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have a hardcoded "exception" like that here? Wouldn't it be best to change the name on the backend side?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, probably. need to clean this up but it's still hardcoded in a bunch of places.

if be, found := r.backends[key]; found {
return be, nil
}
var zero V
Copy link
Member

Choose a reason for hiding this comment

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

Nice one, I'll remember it when I'll play with Generics too.

This commit replaces some overly complex constructs with type
parameters.

Fixes gopasspw#2030

RELEASE_NOTES=[ENHANCEMENT] Generics

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
@dominikschulz dominikschulz merged commit 110c20e into gopasspw:master Dec 21, 2021
@dominikschulz dominikschulz deleted the fix/issue-2030 branch December 21, 2021 09:54
kpitt pushed a commit to kpitt/gopass that referenced this pull request Jul 21, 2022
This commit replaces some overly complex constructs with type
parameters.

Fixes gopasspw#2030

RELEASE_NOTES=[ENHANCEMENT] Generics

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
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.

[Go 1.18] Consider type parameters
2 participants