From 215a239133b55b931d92afb226cc7e1db81feb4b Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Fri, 17 Mar 2023 17:48:21 -0700 Subject: [PATCH] [ci-base] fix last --- d2plugin/plugin.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/d2plugin/plugin.go b/d2plugin/plugin.go index 9b3100ee3..d52c6b4e0 100644 --- a/d2plugin/plugin.go +++ b/d2plugin/plugin.go @@ -46,13 +46,18 @@ func (f *PluginSpecificFlag) AddToOpts(opts *xmain.Opts) { opts.Int64("", f.Name, "", val, f.Usage) case "[]int64": var slice []int64 - for _, v := range f.Default.([]interface{}) { - switch defaultType := v.(type) { - case int64: - slice = append(slice, defaultType) - case float64: - // json unmarshals numbers to float64 - slice = append(slice, int64(defaultType)) + switch defaultType := f.Default.(type) { + case []int64: + slice = defaultType + case []interface{}: + for _, v := range defaultType { + switch defaultType := v.(type) { + case int64: + slice = append(slice, defaultType) + case float64: + // json unmarshals numbers to float64 + slice = append(slice, int64(defaultType)) + } } } opts.Int64Slice("", f.Name, "", slice, f.Usage)