packagemainimport("fmt""strings")funcgetName(params...interface{}){aa:=strings.Join([]string(params),'_')fmt.Println(aa)}funcmain(){getName("redis","100","master")}看上面的代码,我想把传入的参数params用"_"连接,但是将params转成[]string类型时失败了,请指教。假如假如getName("redis","100","master")改为getName("redis",100,"master")编译没错误,但是运行时报错panic:interfaceconversion:interfaceisint,notstring
摇曳的蔷薇
相关分类