File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ import (
1717// values which do not match the expected `{product}/{version} ({comment})`
1818// pattern (where version and comment are optional) return a zero value struct.
1919func FromSlice [T any ](sl []T ) config.UserAgentProducts {
20- return slices .ApplyToAll (sl , func (v T ) config.UserAgentProduct { return fromAny (v ) })
20+ return slices .ApplyToAll (sl , func (v T ) config.UserAgentProduct { return from (v ) })
2121}
2222
23- func fromAny (v any ) config.UserAgentProduct {
24- if s , ok := v .(string ); ok {
23+ func from [ T any ] (v T ) config.UserAgentProduct {
24+ if s , ok := any ( v ) .(string ); ok {
2525 parts := strings .Split (s , "/" )
2626 switch len (parts ) {
2727 case 1 :
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ func TestFromSlice(t *testing.T) {
6161 }
6262}
6363
64- func Test_fromAny (t * testing.T ) {
64+ func Test_from (t * testing.T ) {
6565 t .Parallel ()
6666
6767 tests := []struct {
@@ -136,9 +136,9 @@ func Test_fromAny(t *testing.T) {
136136 for _ , tt := range tests {
137137 t .Run (tt .name , func (t * testing.T ) {
138138 t .Parallel ()
139- got := fromAny (tt .v )
139+ got := from (tt .v )
140140 if ! reflect .DeepEqual (got , tt .want ) {
141- t .Errorf ("fromAny () = %+v, want %+v" , got , tt .want )
141+ t .Errorf ("from () = %+v, want %+v" , got , tt .want )
142142 }
143143 })
144144 }
You can’t perform that action at this time.
0 commit comments