We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f107925 commit 0960d8fCopy full SHA for 0960d8f
pkg/action/utils.go
@@ -144,8 +144,21 @@ func getDefaultByType(o *Option) interface{} {
144
}
145
146
func defaultVal[T any](val interface{}, d T) T {
147
- if val != nil {
148
- return val.(T)
+ if val == nil {
+ return d
149
+ }
150
+
151
+ switch v := val.(type) {
152
+ case T:
153
+ return v
154
+ case []interface{}:
155
+ if _, ok := (interface{})(d).([]string); ok {
156
+ strSlice := make([]string, len(v))
157
+ for i, item := range v {
158
+ strSlice[i] = fmt.Sprintf("%v", item)
159
160
+ return (interface{})(strSlice).(T)
161
162
163
return d
164
0 commit comments