-
-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove usages of experimental maps package (#7849)
All 4 usages of the `maps.Keys` function from the `golang.org/x/exp/maps` package can be refactored to a simpler alternative. If we need it in the future, it is available in the standard library since Go 1.23.
- Loading branch information
Showing
12 changed files
with
92 additions
and
176 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/letsencrypt/boulder/test" | ||
) | ||
|
||
func Test_findActiveInputMethodFlag(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
setInputs map[string]bool | ||
expected string | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "No active flags", | ||
setInputs: map[string]bool{ | ||
"-private-key": false, | ||
"-spki-file": false, | ||
"-cert-file": false, | ||
}, | ||
expected: "", | ||
wantErr: true, | ||
}, | ||
{ | ||
name: "Multiple active flags", | ||
setInputs: map[string]bool{ | ||
"-private-key": true, | ||
"-spki-file": true, | ||
"-cert-file": false, | ||
}, | ||
expected: "", | ||
wantErr: true, | ||
}, | ||
{ | ||
name: "Single active flag", | ||
setInputs: map[string]bool{ | ||
"-private-key": true, | ||
"-spki-file": false, | ||
"-cert-file": false, | ||
}, | ||
expected: "-private-key", | ||
wantErr: false, | ||
}, | ||
} | ||
|
||
for _, tc := range tests { | ||
t.Run(tc.name, func(t *testing.T) { | ||
result, err := findActiveInputMethodFlag(tc.setInputs) | ||
if tc.wantErr { | ||
test.AssertError(t, err, "findActiveInputMethodFlag() should have errored") | ||
} else { | ||
test.AssertNotError(t, err, "findActiveInputMethodFlag() should not have errored") | ||
test.AssertEquals(t, result, tc.expected) | ||
} | ||
}) | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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