Using go build but I also see the -test flags

agolangf · · 474 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have a <code>main.go</code> and <code>mypkg/...go</code>. I use <code>go build -o main main.go</code> and which has some flags I require. But I also see the test flags. Why is this happening? What am I missing?</p> <pre><code>Usage of ./main: -docker string Docker API Path, defaults to local (default &#34;unix:///var/run/docker.sock&#34;) -httptest.serve string if non-empty, httptest.NewServer serves on this address and blocks -port int The default port to listen (default 8000) -test.bench string regular expression per path component to select benchmarks to run -test.benchmem print memory allocations for benchmarks -test.benchtime duration approximate run time for each benchmark (default 1s) -test.blockprofile string write a goroutine blocking profile to the named file after execution -test.blockprofilerate int if &gt;= 0, calls runtime.SetBlockProfileRate() (default 1) </code></pre> <p>dockerPath and port are my flags, but as you can see the others are not my flags.</p> <hr/>**评论:**<br/><br/>mustafaakin: <pre><p>I used flag.newflagset to avoid it</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

474 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传