<p>Thanks for reading, and I hope it's an appropriate question. Windows Go, C:\go_win for install, with C:\go_win\bin on path. I've got my workspace on X:\GO_WS\, with <code>pkg</code> <code>src</code> and <code>bin</code> all present. </p>
<p>I've worked through the hello world tutorial twice now, but I'm getting my <code>go build</code> of a package installed to the C:\go_win\pkg\windows_amd64. My workspace X:\GO_WS\pkg is empty - no initialized windows_amd64 directory.</p>
<p>It seems like the separation between the Workspace and 'primary Go' install locations should be kept pretty clean - and the tutorial says my <code>stringutils.a</code> <em>should</em> be in GO_WS\pkg.</p>
<p>Any thoughts?</p>
<p>Thanks!</p>
<p>edit: be not bin</p>
<hr/>**评论:**<br/><br/>Sythe2o0: <pre><p>What tutorial is telling you about <code>GO_WORKSPACE</code>? I've never heard of that variable before-- your workspace in Go is almost always your package inside of your <code>GOPATH</code>, and that's also where binaries will be installed: <a href="https://golang.org/doc/code.html#GOPATH" rel="nofollow">https://golang.org/doc/code.html#GOPATH</a></p></pre>nsd433: <pre><p>I'm not sure what tutorial you're looking at (the 1st two hits on google for "go hello world tutorial" don't mention "pkg"), but in general only packages compile to files in <code>pkg/</code>. You're probably compiling a package named 'main', which isn't a real package, and doesn't show up in <code>pkg/</code>.</p></pre>carsncode: <pre><p>You can pretty much just ignore pkg entirely. It's just a cache of compiled objects, completed binaries are put into bin.</p></pre>justinisrael: <pre><p>Some of your terminology needs to be clarified if anyone is going to be able to assist you. GOROOT is the installation path of Go. You generally don't need to set this or even think about it beyond the bin/ being on your PATH. Nothing of your own projects should get installed here. GOPATH is most commonly set to a single user location as the top level directory to contain all Go source code. This is the location where you might see a pkg cache location for built libraries. Officially there is no "WORKSPACE" env var so this must either be confused with GOPATH or be a concept specific to a 3rd party tool or tutorial. It would be ideal for you to be specific about the details of the instructions you have followed. </p></pre>
New to Go: `go build` of a package puts the binary in GO_ROOT, not GO_WORKSPACE, /pkg
agolangf · · 416 次点击这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传