我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Golang…字符串类型的arg函数

Why i cant put args in function

func ex(c string,ex ...string) { exec.Command(c,ex) }

get error cannot use args (type []string) as type string. Why?

You can use: ex... in the statement exec.Command(c,ex...) instead of just ex

Below as an example:

func ex(c string,ex ...string) { exec.Command(c,ex...) }

近期文章

  • 如何在Golang中打印接口的单个​​元素值
  • 一个分片只有一个名为list的元素,为什么subslice list [1:]可以工作?
  • 同时从两个不同的goroutine调用方法是否安全?
  • 如何为对象创建结构并在Golang中获取值? [重复]
  • 导入包装和类型
  • 如何在超级账本结构中将我的链码从本地转换为同级?
  • golang json无法正确解析带有嵌入式结构标签的字段[关闭]
  • 在Go中封送[] interface {}
  • 在go lang中使用exec.command进行网络使用
  • 如何安装libvirt-go? (pkg配置)
  • Golang UDP和TCP彼此并排
  • 类型声明的位置
  • 将值和切片存储在地图中
  • 走文件路径。步行行为
  • 如何定义静态成员函数?
  • 如何在golang中的嵌套结构范围内?
  • Panic()与struct vs指针的含义?
  • 如何在go中表达C ++逻辑的“新”运算符?
  • 如何在Golang中将接口{}转换为嵌套树
  • 如何从快照ID获取卷ID?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华