最近发布的主题
最近发布的文章
暂无
最近分享的资源
暂无
最近发布的项目
暂无
最近的评论
-
评论了主题 如何在switch中对多个type进行匹配#3楼 @golwei 但是如果是非type类型的switch,是支持多条件判断的,比如 ``` package main import ( "fmt" "runtime" ) func main() { fmt.Print("Go runs on ") oss := "golang OS" switch os := runtime.GOOS; oss { case "darwin": fmt.Println("OS X.") case "golang OS", "linux": fmt.Println("Linux.") default: // freebsd, openbsd, // plan9, windows... fmt.Printf("%s.", os) } } ```
-
参考https://stackoverflow.com/questions/22781788/how-could-i-pass-a-dynamic-set-of-arguments-to-gos-command-exec-command
-
找到原因了, 是调用时对args的使用不当导致的。 `exec.Command("myScript", arg1, arg2).Output()` 时,arg1 包含了多个由空格分隔的参数,需要用arg []string记录所有参数,然后用来运行 `exec.Command("myScript", arg...).Output()`
-
评论了主题 go subrepo 有没有国内镜像?