goeclipse 怎么GDB 以及怎么传参运行

(>^ω^<)喵上树 2015-07-08 11:33:47
我用eclipse 搭建好了开发环境。


package main

import (
"github.com/codegangsta/cli"
//"fmt"
"os"
)

func main() {
app := cli.NewApp()
app.Name = "greet"
app.Usage = "fight the loneliness!"
app.Action = func(c *cli.Context) {
println("hello", c.Args()[0])
}

app.Run(os.Args)

}


我在12行打了个断点,用gdb 运行提示
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.



在linux 下带参运行直接 ./a.out argv 就可以了。
那如下面的怎么运行时传参数?

package main
import (
"fmt"
"os"
"strings"
)
func main() {
who:="World!"
if len(os.Args)>1 {
who =strings.Join(os.Args[1:]," ")
}
fmt.Println("Hello",who)
}
...全文
1574 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

2,190

社区成员

发帖
与我相关
我的任务
社区描述
go语言学习与交流版
社区管理员
  • go语言社区
  • Freeman Z
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧