Go and IDE's

blov · · 893 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Just wondering how many here are using an IDE to work with Go, and what the preferred product is. I&#39;m using Webstorm but I also have the Gogland beta ide (which honestly I never use, not sure why) Or are most folks just running things from the favorite editor?</p> <hr/>**评论:**<br/><br/>dlsniper: <pre><p>The Go Team recently added this page to the documentation website: <a href="https://golang.org/doc/editors.html" rel="nofollow">https://golang.org/doc/editors.html</a> as a comparison of the popular editors for Go. There are many other things each of them can do so try them out and use whatever makes you the most productive.</p></pre>MARTEX8000: <pre><p>Oh thanks for that, just getting started in Go and at times the resources are wonderfully overwhelming...shoulda looked there first!</p></pre>dlsniper: <pre><p>Cool, feel free to ping me if you have any issues / need any guidance for Gogland / Webstorm + Go plugin or open an issue here: <a href="https://youtrack.jetbrains.com/issues/Go" rel="nofollow">https://youtrack.jetbrains.com/issues/Go</a> ;)</p></pre>__ek: <pre><p>What is &#34;Type-aware autocompletion&#34;? VS Code is definitely not type-unaware.</p></pre>etherealflaim: <pre><p>The only thing I can think is that it means the autocomplete box is not sorted to prefer values that are the appropriate type for the current context (method argument, etc) in the way some Java editors do.</p></pre>dlsniper: <pre><blockquote> <p>The only thing I can think is that it means the autocomplete box is not sorted to prefer values that are the appropriate type for the current context (method argument, etc) in the way some Java editors do.</p> </blockquote> <p>It&#39;s actually the opposite. It&#39;s narrowing down the completion scope so that you only can get suggestions for what&#39;s appropriate based on the type of the parameter / value / etc used.</p> <p>Maybe I&#39;m ignorant to how VS Code works, but here&#39;s what that feature means:</p> <ul> <li>Gogland: <a href="https://i.imgur.com/eDGtXS5.png" rel="nofollow">https://i.imgur.com/eDGtXS5.png</a></li> <li>VS Code: <a href="https://i.imgur.com/sTwcCzJ.png" rel="nofollow">https://i.imgur.com/sTwcCzJ.png</a></li> </ul> <p>If there&#39;s a way to obtain the same results in VS Code as in Gogland? In Gogland there are two completion modes, the normal one (invoked automatically when typing or manually via Ctrl+Space) or the &#34;Smart type&#34; one which is invoked via (Ctrl+Shift+Space). This &#34;type-aware&#34; is basically how the feature is named in all JetBrains IDEs, &#34;Smart type&#34; completion.</p> <p>Furthermore, Gogland can &#34;predict&#34; what is likely to be typed by the user based on further analysis it performs.</p> <p>Hope it helps.</p></pre>Growlizing: <pre><p>Thank you for screenshots. This is the reason I can&#39;t use anything but a good IDE ;)</p></pre>__ek: <pre><p>Ok, that makes sense. My background is C++ and I haven&#39;t used JetBrains software yet. You could say that Gogland has smarter autocomplete. But VS Code is not type-unaware because otherwise this wouldn&#39;t work: something().[autocomplete members of return type of something]. There are actual type-unaware autocompletes, for example the last time I checked a base install of Vim comes with a simple identifier autocomplete when you press ctrl+n. I guess the golang doc could be improved to clarify what type-aware means in that table.</p></pre>alireza94: <pre><p>I am a big fan of VSCode for Golang development, it&#39;s fast and feature rich. You will get autocomplete, go to definition, refactoring, automatic formatting and import optimization, test coverage viewer, and of course debugger.</p></pre>drink_with_me_to_day: <pre><p>Autocomplete isn&#39;t as snappy as I&#39;d like it to be.</p></pre>Smt923: <pre><p>For me (windows/vscode), autocomplete seems to be pretty snappy? <a href="https://i.imgur.com/l0aXYJv.gifv" rel="nofollow">https://i.imgur.com/l0aXYJv.gifv</a></p></pre>drink_with_me_to_day: <pre><p>What I mean is that I don&#39;t get autocomplete when I expect to. It hangs searching, then it just shows <code>PANIC</code> as the only option in the dropdown, for functions defined in the same package. I have to resort to Ctrl+hover to see the method signature.</p></pre>Smt923: <pre><p>Oh that&#39;s weird, I don&#39;t think I&#39;ve ever had that, the worst thing for me is on startup theres a good few seconds before it kicks in but otherwise tends to be pretty smooth for me</p></pre>msgtonaveen: <pre><p>I too use VS code</p></pre>Rhelza: <pre><p>+1 to VS Code</p></pre>VanPepe: <pre><p>Agree on VSCode. Ctrl+Click on a method/function is the best thing ever and usally just comes on IDE&#39;s, here it works with a plugin.</p> <p>Even support for an integrated terminal is awesome, on Windows you can even run WSL in it.</p></pre>PaluMacil: <pre><p>I too like VS Code. I do anticipate trying Gogland when it has an official release because Jetbrains is fantastic even if not entirely my style / preference.</p></pre>phlatphrog: <pre><p>Visual Studio Code. Not an IDE, but afaik the best for Go dev, once you install the go helpers.</p></pre>justinlindh: <pre><p>I&#39;ve tried a few over the years. The ones I&#39;m happy using, at the moment, are: VS Code, vim-go, Gogland. Of those 3, I now prefer Gogland. It has the occasional crash, but the integrated debugging environment is excellent. I held off on trying it for a long time because I was happy with VS Code, but I&#39;m glad I finally did check it out. I&#39;ll be using it the most going forward.</p></pre>dlsniper: <pre><blockquote> <p>It has the occasional crash</p> </blockquote> <p>That&#39;s not good, can you please open an issue here: <a href="https://youtrack.jetbrains.com/issues/Go" rel="nofollow">https://youtrack.jetbrains.com/issues/Go</a> with the logs attached? You can find them via Help | Show logs in... and zip up the directory that opens up.</p> <p>Thank you.</p></pre>justinisrael: <pre><p>I&#39;ve been trying out Goglands for a week or so as well. It&#39;s very feature rich but I too have found it a bit buggy, laggy, and has crashed twice. I run it on an internal network so I have not been able to submit the report. I&#39;m hoping they make it a bit faster to run through its file sync and highlight routine every time you change and save code or open new files. Seems like I wait for at least 10 seconds on large projects. I had to up the VM ram to at least 2gb as well because it kept running out of memory, as well as running out of inotify handles </p></pre>dlsniper: <pre><p>I&#39;m sorry you are having problems, I&#39;ll ping the devs to also have a look at this but without the logs / <a href="https://intellij-support.jetbrains.com/hc/en-us/articles/207241235-Reporting-performance-problems" rel="nofollow">https://intellij-support.jetbrains.com/hc/en-us/articles/207241235-Reporting-performance-problems</a> it&#39;s next to impossible to figure out what causes the issues and fix them. </p> <p>Are you using the latest release, EAP 15 (173.2696.28)? Can you provide some steps to try and reproduce this? You&#39;ve mentioned a VM, should I run any particular VirtualBox + Linux version + Gogland + some open-source projects in it to reproduce this? Do you have the files mounted from the host OS? Maybe the VM has issues with file system making it slow for the IDE to use?</p> <p>Do the slow sync issues this happen if you run the IDE on your computer and sync the sources in the VM using the Remote Host plugin? You can have a look at this short video I&#39;ve created on how to do this: <a href="https://youtu.be/D_04aG9eH1U" rel="nofollow">https://youtu.be/D_04aG9eH1U</a></p> <p>Is the project open-sourced by any chance / can you at least provide the list of open-source packages it depends on so that I can try and recreate it?</p> <p>Thank you.</p></pre>justinisrael: <pre><p>When I say VM I meant the Java Virtual Machine that Gogland uses. It&#39;s a setting in the Help menu to increase the heap size available to Gogland. So I am using it on a high end workstation with code mounted on NFS. That could be the cause of high usage of inotify handles and slow scanning. But it&#39;s how we work in our company to have our project data available to all workstations. I think you could pick any large project, like say Kubernetes, and just load it from and NFS mount. It requires a lot of ram and adjustments to the max inotify handles. And the sync and highlight is pretty slow. </p></pre>SirWusel: <pre><p>I started working with Go a couple of days back, so I&#39;m far from being an expert but I use a lot of RubyMine and IDEA at work so I got Gogland right away and so far I&#39;m very happy with it. It has some if not most of the features that you&#39;d expect from a Jetbrains IDE and they also work pretty well. Especially the intregrated UI for debugging is extremely helpful, in my opinion. But I&#39;ll still give vim-go a try as well, as vim is something I wanted to check out for quite some time now, anyways. But jeah, Gogland is definitely worth trying out. And it&#39;s still completely free.</p></pre>amorphatist: <pre><p>Kudos to <a href="/u/disniper" rel="nofollow">/u/disniper</a> for jumping in with all the info. I&#39;ve been using the Go plugin and now Gogland since their early days, and the amount of progress has been remarkable; I find it already to be the best dev setup for me. I&#39;ve recommended it to lots of other devs, even though still in EAP.</p> <p>Quick question: I have a Go project that has an embedded SQLite DB via Cgo. Last time I looked into it (quite some time ago) the Gogland debugger barfed in this situation, so I ended making a separate build that excluded SQLite. Has this been fixed, or can it be fixed? Or is this an underlying issue with delve?</p> <p>One more quick question: Have you guys decided to stick with &#34;Gogland&#34; as the brand? It really really does not sounds good in English to my ear, almost like some crazy europeans with their own language came up with it... (speaking as a european from a small country with its own odd language)</p> <p>EDIT: I spent a quick minute thinking about the IDE name once. I got stuck on trying to incorporate &#34;gopher&#34;, the best I could come up with was &#34;GoForIt / Goforit&#34; or &#34;Gopherit&#34;. Then a friend remarked that &#34;GoFerret&#34; seems like a direct affront to our beloved mascot.</p></pre>MARTEX8000: <pre><p>I think &#34;Goglide&#34; would be a better and less cumbersome name...</p></pre>dlsniper: <pre><blockquote> <p>Kudos to <a href="/u/disniper" rel="nofollow">/u/disniper</a> for jumping in with all the info. [...]</p> </blockquote> <p>Thank you! And happy to hear you like it.</p> <blockquote> <p>Quick question: I have a Go project that has an embedded SQLite DB via Cgo. Last time I looked into it (quite some time ago) the Gogland debugger barfed in this situation, so I ended making a separate build that excluded SQLite. Has this been fixed, or can it be fixed? Or is this an underlying issue with delve?</p> </blockquote> <p>Can you please open / ping me in the relevant issue on the tracker? Try the latest version + Go 1.9.1 and hopefully things should be better now (due to a lot of improvements both in Delve but more important in Go itself).</p> <blockquote> <p>Have you guys decided to stick with &#34;Gogland&#34; as the brand?</p> </blockquote> <p>You can suggest / vote for the existing suggestions here: <a href="https://youtrack.jetbrains.com/issue/GO-3054" rel="nofollow">https://youtrack.jetbrains.com/issue/GO-3054</a></p></pre>scalapar: <pre><p>both Atom and Visual Studio Code are good. Visual Studio Code is a bit faster.</p></pre>natefinch: <pre><p>Visual Studio Code.</p></pre>itsenov: <pre><p>I was initially using Atom, but it developed a bug in Windows that constantly crashes it. Tried everything to fix it</p> <p>So now I&#39;m using VSCode and I love it. </p></pre>SSoreil: <pre><p>I&#39;ve been using Gogland almost exclusively for a few months now. Before this I used Vim with Vim-go mostly and for a few weeks Visual Studio Code to try it out.</p> <p>Gogland is pretty close to where I would want a Go IDE to be at this point. Vim-go is also nice if you enjoy the general Vim workflow.</p> <p>Visual Studio Code makes for a &#34;lightweight&#34; Gogland alternative, depending on what you want from an editor / IDE it might be sufficient.</p></pre>dlsniper: <pre><blockquote> <p>Gogland is pretty close to where I would want a Go IDE to be at this point. </p> </blockquote> <p>What could it do better?</p></pre>govision: <pre><p>I use cloud9 ide <a href="https://c9.io" rel="nofollow">https://c9.io</a></p> <p>The support is good enough but the real benefit is it being online. </p></pre>MARTEX8000: <pre><p>Wow, thats a cool IDE, man I had no idea when I started this thread how much it would turn into a buffet...lots to choose from...how do you feel cloud9 does in terms of compiling, does the online factor in to performance at all? (Just off the cuff it seems that your internet connection might add a bit of latency, but I have no idea) Cloning your entire environment is appealing though...</p></pre>govision: <pre><p>Umm it&#39;s nice in that you get a container and terminal. But they say explicitly they will not serve your app in a production environment. I think because they may not have the team and hardware. But it&#39;s perfect for building stuff at work or school or at home. I use a chrome book and just open it up and code. No waiting for load times, updates, errors, initialization, other processes, or anything! Just pull the top up and code. The only downside is cloud 9 sometimes has maintenance. But the benefit is for interviews when you need to show them your program code/working example and it makes sure it&#39;s using the same environment. I actually write in cloud 9 and pull GitHub and then clone to digital ocean online terminal and that&#39;s it. It&#39;s also cool to share projects and it has code blame and you can actually code at the same time and see their cursor. So yeah that&#39;s pretty much what I use and do so I don&#39;t ever wait or worry about devices. Also cloud 9 has go installed by default in each container. So no setup required. Only thing that kinda is goofy is the whole database server ports and dealing with cors with it. Which can be a pain but it comes with phpmyadmin installed with a database. But the ports thing kinda gets weird with any container environment and leads to bugs. </p> <p><a href="https://community.c9.io/t/setting-up-phpmyadmin/1723" rel="nofollow">https://community.c9.io/t/setting-up-phpmyadmin/1723</a></p> <p><a href="https://docs.google.com/document/d/1Zb9GCWPKeEJ4Dyn2TkT-O3wJ8AFc-IMxZzTugNCjr-8/edit?usp=drivesdk" rel="nofollow">https://docs.google.com/document/d/1Zb9GCWPKeEJ4Dyn2TkT-O3wJ8AFc-IMxZzTugNCjr-8/edit?usp=drivesdk</a></p> <p>For those who are worried about security, idk use a locked pc, stored in a locked room, with a program that rewrites and deletes your data as you write I guess. Cause you are using chrome right now anyways....</p></pre>MARTEX8000: <pre><p>Ok that makes sense, and might fit with me needing a &#34;mobile&#34; environment to code while I wait around etc...I mainly code on a Mac but mornings I&#39;m logged onto my Windows machine...</p></pre>govision: <pre><p>I just edited my comment for some resources and well the port issues that arise for any container environment that&#39;ll make you frustrated. </p> <p><a href="https://docs.c9.io/docs/multiple-ports" rel="nofollow">https://docs.c9.io/docs/multiple-ports</a> <a href="https://dinosaurscode.xyz/go/2016/06/19/golang-mysql-authentication/" rel="nofollow">https://dinosaurscode.xyz/go/2016/06/19/golang-mysql-authentication/</a></p> <p><a href="https://github.com/GoesToEleven/golang-web-dev/blob/master/021_third-party-serveMux/01_julienschimdt/main.go" rel="nofollow">https://github.com/GoesToEleven/golang-web-dev/blob/master/021_third-party-serveMux/01_julienschimdt/main.go</a></p></pre>gsserge: <pre><p>Atom with the go-plus plugin is pretty good.</p></pre>smantziaris: <pre><p>i use visual studio code. I try any new gogland release but it is has the following problems:</p> <ul> <li>it is resource intensive, 1GB for a simple console application?</li> <li>It takes a lot of time to get all the source code indexed, again for a simple console application?</li> <li>It will cost a lot of money (like the others do) and will almost be the same as the free stuff if not worse.</li> </ul> <p>on the plus side the rename works better than in visual studio code...</p> <p>I stay with Visual Studio Code for now and hope gogland will address all the above in order to be of interest to me.</p></pre>Emacs24: <pre><p>I used Emacs mostly, now turned to Gogland, even though my Emacs setup is nearly as powerful as Gogland:</p> <ol> <li>Autocompletion: Gogland is better than gocode, but it is not night and day difference (Gogland can autocomplete for non-imported packages).</li> <li>Code navigation: nearly the same</li> <li>Refactoring: Gogland leads a bit – on receiver renaming it suggests to rename all receivers and it can change package names. Nor go-rename, nor go-doctor can do this. Extraction is on about the same level (godoctor behind it for Emacs)</li> <li>Project navigation – Gogland leads.</li> <li>Linting – Emacs which directly uses golinter is much better. I miss warnings for uncommented public names in Gogland.</li> <li>Go toolset integration. By default Gogland is better, but Emacs with my setup is more potent.</li> <li>Debug. Slight lead for Gogland here for overall experience, although not by much.</li> </ol> <p>All in all, I cannot say there&#39;s huge difference between them for Go coding. But I found myself using Gogland one day.</p></pre>dlsniper: <pre><p>Thanks for the overview.</p> <p>A couple of things to note:</p> <blockquote> <p>Linting – Emacs which directly uses golinter is much better. I miss warnings for uncommented public names in Gogland.</p> </blockquote> <p>This has been fixed in EAP 15, see: <a href="https://blog.jetbrains.com/go/2017/09/28/gogland-eap-15-inspections-intentions-performance-intellij-2017-3-and-more/" rel="nofollow">https://blog.jetbrains.com/go/2017/09/28/gogland-eap-15-inspections-intentions-performance-intellij-2017-3-and-more/</a> And more things are on their way.</p> <blockquote> <p>Go toolset integration. By default Gogland is better, but Emacs with my setup is more potent.</p> </blockquote> <p>This is something that&#39;s also being worked on, if you have any specific thing that you&#39;d like to see, drop a note either to me or here <a href="https://youtrack.jetbrains.com/issues/Go" rel="nofollow">https://youtrack.jetbrains.com/issues/Go</a></p> <p>Have fun coding.</p></pre>Emacs24: <pre><p>No, I mean full time on the fly linter which will immediately mark &#34;bad&#34; parts. Your inspections don&#39;t cover full golint functionality, that&#39;s it.</p> <blockquote> <p>This is something that&#39;s also being worked on, if you have any specific thing that you&#39;d like to see, drop a note either to me or here <a href="https://youtrack.jetbrains.com/issues/Go" rel="nofollow">https://youtrack.jetbrains.com/issues/Go</a></p> </blockquote> <ol> <li>Gogland binds <code>go generate</code> to the specific file and even to the specific <code>//go:generate ...</code> line while it will actually run any generation command within a package. This doesn&#39;t make a sense. There should be a way to know if package has any <code>//go:generate</code> at all and an ability to run generation for the package.</li> <li>Integrate <code>go install</code>. Bound to <code>main</code> packages.</li> </ol> <p>You see, this is really hard to even to understand how to clearly implement this for the Gogland. And is fairly trivial in Emacs: <code>go-generate</code> just runs <code>go generate</code> for the package I am currently in and <code>go-install</code> installs a package which is in the current directory.</p></pre>dlsniper: <pre><p>Thank you for feedback!</p> <blockquote> <p>No, I mean full time on the fly linter which will immediately mark &#34;bad&#34; parts. Your inspections don&#39;t cover full golint functionality, that&#39;s it.</p> </blockquote> <p>This is because <code>golint</code> does not work on in-memory files like the IDE does so the inspections have to be ported. That&#39;s why I said that there&#39;s more to come there.</p> <blockquote> <p>Gogland binds go generate to the specific file and even to the specific //go:generate ... line while it will actually run any generation command within a package. This doesn&#39;t make a sense. There should be a way to know if package has any //go:generate at all and an ability to run generation for the package.</p> </blockquote> <p>I&#39;ve filled this issue: <a href="https://youtrack.jetbrains.com/issue/GO-4581" rel="nofollow">https://youtrack.jetbrains.com/issue/GO-4581</a> to allow running of <code>go generate</code> for the package of the current file.</p> <blockquote> <p>Integrate go install. Bound to main packages.</p> </blockquote> <p>Unfortunately this is not something very straightforward to solve in a manner which will not surprise users. For example: How should this work in case there are two files with two <code>func main()</code> in the same directory? Or what if there are two or more <code>package main</code> in the same project? What should the IDE do in those cases?</p> <blockquote> <p>You see, this is really hard to even to understand how to clearly implement this for the Gogland. And is fairly trivial in Emacs: [...] and go-install installs a package which is in the current directory.</p> </blockquote> <p>If you want to use those tools, you can create custom tools via Settings | Tools | External Tools , see: <a href="https://www.jetbrains.com/help/go/external-tools.html" rel="nofollow">https://www.jetbrains.com/help/go/external-tools.html</a> , which allow you to add any tools you want to the IDE and even bind them to shortcuts / have them run before any Run Configuration starts. </p> <p>Hope it helps.</p></pre>wjkohnen: <pre><blockquote> <p>For example: How should this work in case there are two files with two func main() in the same directory?</p> </blockquote> <p>The same way <code>go install</code> works: </p> <pre><code>$ go install # two_mains ./main2.go:5:6: main redeclared in this block previous declaration at ./main1.go:5:6 </code></pre> <p>Either the project is in fact broken or the dev meant to do sth like <code>go run</code>. The definition of what <code>go install</code> should do is not ambiguous. </p> <blockquote> <p>Or what if there are two or more package main in the same project?</p> </blockquote> <p>Tell the user what to do. </p></pre>wgpshashank: <pre><p>I use Intellj but It stuck during debugging. Any of you faced the similar issue ? </p></pre>dlsniper: <pre><p>It could happen for a number of reasons. If you go to Settings | Plugins, what version of the Go plugin do you have? And what version of Go are you using? Which OS? Is the project reproducible by me? You can also open an issue here: <a href="https://youtrack.jetbrains.com/issues/Go" rel="nofollow">https://youtrack.jetbrains.com/issues/Go</a> and I&#39;ll be happy to help out as well. Thank you.</p></pre>DualRearWheels: <pre><p>Had a luck to stumble on LiteIDE first thing, and never felt need to search for alternatives. It is fast, productive and not bloated which I hate. It is open source and works on huge number of platforms.</p> <p><a href="https://github.com/visualfc/liteide" rel="nofollow">https://github.com/visualfc/liteide</a></p></pre>e1ch1: <pre><p>LiteIDE has no support for multiple cursor editing and other small things you expect to work out of the box when coming from other editors like Atom or VSCode. Despite this it&#39;s one of the best go-centric IDE&#39;s out there.</p></pre>dm319: <pre><p>The 2016 Go Survey results:</p> <p>My preferred code editor: (ordered choice, up to 2)</p> <pre><code>1,359 (25, 13%) Vim 814 (14, 9%) VSCode 676 (10, 9%) Atom 687 (13, 6%) IntelliJ 655 (10, 8%) Sublime Text 305 (6, 2%) Emacs 137 (2, 2%) Visual Studio 153 (3, 2%) LiteIDE 99 (1, 2%) Eclipse 37 (1, 1%) Acme 238 (4, 3%) Other 425 (12%) No response </code></pre> <p><a href="https://blog.golang.org/survey2016-results" rel="nofollow">https://blog.golang.org/survey2016-results</a></p></pre>

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

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