<p>Was wondering if anybody here uses Windows 10 + WSL (aka Bash for Windows) for Go development?</p>
<p>Although I do have a Linux laptop where I currently do most of my development, I have Win10 on my desktop & would like to experiment with development on there.</p>
<p>Ideally I'd want go installed under WSL, however the issue I see going forward is where to keep my GOPATH and all src code. One of the main limitations(?) with WSL is that you cannot modify files from the linux subsystem within Windows, so keeping my GOPATH under the linux subsystem and editing using my text editor on Windows won't work. </p>
<p>If anybody has gotten this working (or has some other reasons as to why I <em>shouldn't</em> do this, I'd appreciate it :)</p>
<p><a href="http://daverupert.com/2017/03/my-bash-on-windows-developer-environment/" rel="nofollow">This</a> is the post that inspired me to try in the first place.</p>
<hr/>**评论:**<br/><br/>Redundancy_: <pre><p>I develop Go on Windows, and honestly haven't had much of a need for bash (it was handy for doing some quick file system interaction checks). You can cross compile anyway, but I've found that using Docker for Windows has had very little pain involved.</p></pre>aboukirev: <pre><p>I am developing in Go on Windows and using MSYS2 for <code>bash</code> et al.
Works pretty well. There is an issue with <code>git</code> from MSYS2 not working well with Windows paths as parameters when run from some applications (Visual Studio Code in particular). Solved by using <code>cygpath</code> wrapper. I am cross-compiling for Linux too and then deploying to actual Debian machine.</p>
<p>WSL could be useful for CI but is too much hassle for development at this time.</p></pre>VanPepe: <pre><p>I edit on windows and run stuff via wsl</p>
<p>My go path is ~/go which is a symlink to /mnt/c/Users/.....</p>
<p>Only issue I have is that I can't run tests and such via a GUI in Visual Studio Code.</p>
<p>I also have go installed on windows with go path set to that /mnt/c/Users/.....</p>
<p>That's how Visual knows what code I have in my gopath.</p></pre>thefrontpageofme: <pre><p>This.</p>
<p>Doing the same here - GOPATH points to a symlinked folder under WSL that in turn points to /mnt/c/Users/....</p></pre>brianketelsen: <pre><p><a href="https://brianketelsen.com/my-cross-platform-dev-setup-on-surface-laptop/" rel="nofollow">Here's my (long-ish) writeup on using WSL for Go development:</a></p></pre>[deleted]: <pre><p>I use GoLang in W10 and the same, I dont almost need bash, I just have some utils mapped, like ssh for example.</p></pre>lambrospetrou: <pre><p>One solution would be to have your editor in WSL too and run it using an X-Server in Windows. It's not ideal (some editors like VSCode don't work with X-server) but it works if you really want to be inside WSL most of the time.</p>
<p>I tried that with Sublime Text 3 with success, but returned back to my Linux system after a week!</p>
<p>My article explaining how to set this up <a href="https://www.lambrospetrou.com/articles/windows-linux-subsystem-editor-setup/" rel="nofollow">https://www.lambrospetrou.com/articles/windows-linux-subsystem-editor-setup/</a></p></pre>TurboHaskal: <pre><p>I develop entirely within WSL using plan9port's Acme and Xming. It works great for my needs.</p></pre>skankyyoda: <pre><p>I just develop Go directly on windows the the helping hand of cmder. Haven't come across any issue yet. No need to fudge around with WSL. </p></pre>vorg: <pre><p>A few weeks ago I installed WSL and <code>go1.9.1 linux/amd64</code> on a basic Windows 10 Home computer just out of interest. When I did <code>go run</code> on a simple program I got:</p>
<pre><code>go build command-line-arguments: /usr/local/go/pkg/tool/linux_amd64/compile:
fork/exec /usr/local/go/pkg/tool/linux_amd64/compile: invalid argument
</code></pre>
<p>I didn't bother looking at it any further -- just assumed WSL can't do Linux forking.</p></pre>Killing_Spark: <pre><p>One crazy way would be to use xming and your prefered text Editor from linux inside the wsl. Another would be to set your gopath to some location that is accessible to Windows (/mnt/c/whatever) </p></pre>FIuffyRabbit: <pre><p>Are you using Unix specific things? If not, just do the development with the w10 binaries. </p></pre>Hexodam: <pre><p>Visual studio code + powershell terminal on Windows</p>
<p>Visual studio code + bash on Ubuntu</p>
<p>No need to chase terminals, can use whatever terminal that is available </p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传