Best IDE / text editor for go coding on a Mac

5,271 views
Skip to first unread message

josvazg

unread,
Oct 8, 2011, 5:14:05 AM10/8/11
to golang-nuts
I just got a Mac, I am new to Mac OS X and I plan to do most of my go
coding from Mac. Before I was using edit + plugins on Ubuntu. I am
also familiar with Eclipse on windows and ubuntu for java coding.

What do you recommend as the best IDE or text editor to write go code
on a Mac?
What do you use?
Any chance to get 'errors as you type' in any of these editors or
IDEs?

Peter Bourgon

unread,
Oct 8, 2011, 5:39:53 AM10/8/11
to josvazg, golang-nuts
If you invest a bit of time to set it up, Sublime Text 2 + GoSublime
is the best Go programming experience on the Mac by a large margin.

Jim Whitehead II

unread,
Oct 8, 2011, 6:56:50 AM10/8/11
to peter....@gmail.com, josvazg, golang-nuts

I'm never quite sure why people attach superlatives to things like
this. I know for a fact that Sublime Text 2 + GoSublime doesn't offer
me anything that I don't already have with my standard vim setup +
gocode. I'm glad you have something that works well for you, and it's
certainly a suggestion, but to claim that any other method of editing
Go source on a Mac is behind by a 'large margin' is laughable.

- Jim

Paulo Pinto

unread,
Oct 8, 2011, 8:01:28 AM10/8/11
to golang-nuts
I also don't understand what is so good about Sublime that other
editors
don't already provide.


On Oct 8, 12:56 pm, Jim Whitehead II <jnwhi...@gmail.com> wrote:
> On Sat, Oct 8, 2011 at 10:39 AM, Peter Bourgon <peterbour...@gmail.com> wrote:
> > If you invest a bit of time to set it up, Sublime Text 2 + GoSublime
> > is the best Go programming experience on the Mac by a large margin.
>

josvazg

unread,
Oct 8, 2011, 12:45:24 PM10/8/11
to golang-nuts
Does any option do 'errors as you type'?
Or at least marks the lines with errors?
(I miss that even more than code completion itself)

Sublime text 2 + go sublime seems good with autocompletion, at least
by watching this video:
http://vimeo.com/28246402

Florian Weimer

unread,
Oct 8, 2011, 1:27:14 PM10/8/11
to josvazg, golang-nuts
> Sublime text 2 + go sublime seems good with autocompletion, at least
> by watching this video:
> http://vimeo.com/28246402

Well, *that* is not very impressive.

Does this work with user-defined packages as well? Does it work for
methods, too? (The latter requires a fairly complete Go type
checker.)

Joshua

unread,
Oct 8, 2011, 2:00:02 PM10/8/11
to golan...@googlegroups.com, josvazg
the GoSublime plugin uses the gocode for information so it has a complete Go type checker

Joshua

Paul

unread,
Oct 8, 2011, 10:50:02 AM10/8/11
to golang-nuts
Josvazg,

+1 for SubLime & Go Sublime. Sublime is a great editor and code
completion, compile time, makes its nearly a full IDE (minus
debugging).

Paul

Robert Bloomquist

unread,
Oct 9, 2011, 12:29:46 AM10/9/11
to golan...@googlegroups.com
I use plan9port's acme.  Took a while to get used to the interface, but completely worth it.  I'm yet to find a text editor that uses the mouse as effectively as acme does.

Biomechanica

unread,
Oct 9, 2011, 9:10:54 AM10/9/11
to golan...@googlegroups.com
From my own experience I found EMACS to be quite nice. You can use gocode with it also, so you'll get type checking and all that fun stuff. 

DisposaBoy

unread,
Oct 9, 2011, 9:32:29 AM10/9/11
to golan...@googlegroups.com
The demo is completely outdated, see the feature list on https://github.com/DisposaBoy/GoSublime . Yes it supports errors as you type with its gotype integration, which means pretty much every error that will be reported by the compiler so you don't need to do the build/refresh nonsense just to find out that you mistyped a variable name or that an error in extra.go of package main will cause errors in main.go

DisposaBoy

unread,
Oct 9, 2011, 9:35:45 AM10/9/11
to golan...@googlegroups.com, peter....@gmail.com, josvazg
Someone expressed their opinion, there's no need to be butthurt by it. If you read the feature list at https://github.com/DisposaBoy/GoSublime then you would also know that your claims are simply not true. In any case, we all have our own tastes in editors so let's not start the age-old religious editor wars here...

Jim Whitehead II

unread,
Oct 9, 2011, 10:58:11 AM10/9/11
to golan...@googlegroups.com, peter....@gmail.com, josvazg

I'm not sure that anyone in this thread is 'butthurt'. But thanks for
your mature and constructive reply to a thread that already extols the
virtues of your particular editing environment, which has proven to be
more than capable.

- Jim

josvazg

unread,
Oct 9, 2011, 6:09:43 PM10/9/11
to golang-nuts
It really seems that GoSublime would be a nice tool... if it worked!
;-)

I followed the instructions under Usage.md and it fails to complete
code with error such as:
"Error while running gocode ... file not found"
WHEN gocode is installed and does not complain in the command line

or

"gsfmt failed ... file x.go "
WHEN gofmt works flawlessly with that same .go file

This are my settings:
Packages/User/Gosublime.sublime-settings
http://pastie.org/2667829

Packages/User/Default (OSX)Sublime.sublime-keymap
http://pastie.org/2667882

Packages/GoSublime/Gomake.sublime-build
http://pastie.org/2667893


Peter Bourgon

unread,
Oct 10, 2011, 3:10:38 AM10/10/11
to josvazg, golang-nuts
I had the same problem, and fixed it by providing the absolute path to
both gocode and gofmt in my Gosublime.sublime-settings file.

Sebastian Schlingmann

unread,
Oct 10, 2011, 9:16:18 AM10/10/11
to golang-nuts
Or you could specify the PATH to your go/bin directory in ~/.profile
and not in ~/.bashrc or something else. Sublime Text 2 uses ~/.profile
to set it's environment (at least on Linux...).

jideel

unread,
Oct 10, 2011, 8:25:35 AM10/10/11
to golang-nuts
Vim and/or TextWrangler (BareBones software, makers of BBEdit).
It's enough for me.

Kyle Lemons

unread,
Oct 10, 2011, 7:25:45 PM10/10/11
to peter....@gmail.com, josvazg, golang-nuts
If you invest a bit of time to set it up, Sublime Text 2 + GoSublime
is the best Go programming experience on the Mac by a large margin.

I don't know, I am pretty happy with (lion) fullscreen terminal containing screen containing vim (with gocode if you like it) and various shells.  I've done the "whose IDE is faster" race against people on a number of IDEs against me using vim (both timed and comparing keystrokes to accomplish the same operation) including giving them the advantage of 1key=1click, and vim+screen almost always comes out on top.  The major time vim lost was when using Eclipse's "refactor" feature to edit a bunch of Java files, but I will readily concede that Eclipse is almost required for Java editing these days.

~K

josvazg

unread,
Oct 11, 2011, 1:27:02 PM10/11/11
to golang-nuts
On 10 oct, 09:10, Peter Bourgon <peterbour...@gmail.com> wrote:
> I had the same problem, and fixed it by providing the absolute path to
> both gocode and gofmt in my Gosublime.sublime-settings file.

This worked for me.

John Asmuth

unread,
Oct 11, 2011, 1:31:59 PM10/11/11
to golan...@googlegroups.com, josvazg, peter....@gmail.com
With os x you have to set env vars in /etc/launchd.conf if you want programs launched by double-clicking to see them.

josvazg

unread,
Oct 11, 2011, 1:53:26 PM10/11/11
to golang-nuts


On 10 oct, 15:16, Sebastian Schlingmann
<mightyofthe...@googlemail.com> wrote:
> Or you could specify the PATH to your go/bin directory in ~/.profile
> and not in ~/.bashrc or something else. Sublime Text 2 uses ~/.profile
> to set it's environment (at least on Linux...).

This didn't work, at least on my Mac. I really need to place the full
path on Sublime Text 2 config files, neither the path with a variable
nor the command alone will do.

josvazg

unread,
Oct 11, 2011, 5:04:02 PM10/11/11
to golang-nuts
On 11 oct, 19:31, John Asmuth <jasm...@gmail.com> wrote:
> With os x you have to set env vars in /etc/launchd.conf if you want programs
> launched by double-clicking to see them.

That doesn't work on OS X Lion. It seems the guys at Apple thought it
was smart to take away environment variables in Lion:

http://stackoverflow.com/questions/6770411/mac-os-x-lion-no-longer-recognizes-environment-plist:

"I ran into the same issue today. I called Apple Support and after
being escalated to a Senior Advisor, then to her supervisor, I was
told that they no longer support environment.plist and that there is
no officially-supported method for defining environment variables in
Mac OS 10.7."

I just can't believe it!
There must be some way to force Sublime Text to have a properly
configured environment or at least a proper PATH variable setup.
"make" command works like that so IT is using some kind of PATH env
variable already.

josvazg

unread,
Oct 11, 2011, 5:49:35 PM10/11/11
to golang-nuts

> That doesn't work on OS X Lion. It seems the guys at Apple thought it
> was smart to take away environment variables in Lion:

Ok,

~/.launchd.conf seems unsupported, but /etc/launchd.conf still works.

This /etc/launchd.conf worked for me after session restart:
setenv GOROOT $HOME/go
setenv GOARCH amd64
setenv GOOS darwin
setenv PATH $PATH:$GOROOT/bin

John Asmuth

unread,
Oct 11, 2011, 7:28:43 PM10/11/11
to golan...@googlegroups.com
Bizarre.

Thanks for the research!

josvazg

unread,
Oct 12, 2011, 8:11:10 AM10/12/11
to golang-nuts
>
> This /etc/launchd.conf worked for me after session restart:
> setenv GOROOT $HOME/go
> setenv GOARCH amd64
> setenv GOOS darwin
> setenv PATH $PATH:$GOROOT/bin

I don't know what happened, but yesterday it worked for me and today
it didn't.

It seems that launchd.conf could not expand variables anymore
(although yesterday it could)
I had to change my /etc/launchd.conf to this single liner:
setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/
Users/josvazg/go/bin


Does anyone know how to force launchd reload the /etc/launchd.conf
file WITHOUT rebooting?
(today exiting and reentering the session didn't work, yesterday it
did)
Does Mac Os X behavior change from one day to the other? ;-) Maybe
today it was not in the mood to make things easy for me...

Jennal

unread,
Oct 13, 2011, 3:01:30 AM10/13/11
to golang-nuts
I put the setenvs in /etc/launchd.conf.
But when I use command-b to build, I got this message:

/Users/jennalcn/Documents/Setup/go/bin/gomake: line 3: exec: make: not
found

And I found the following line in rc.common:

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/
CoreServices ; export PATH

launchd.conf runs before rc.common? or rc.common would not run?
make command is in /usr/bin
I am new in unix. how can I do?

DisposaBoy

unread,
Oct 13, 2011, 1:03:03 PM10/13/11
to golan...@googlegroups.com
do you mind filing a bug on github? it's probably nothing wrong with gosublime per se but I'm sure there must be something i can do to help. iirc there was already a similar bug but that was more linux specific. unfortunately i can't reproduce the issue on linux and the only other system i have is windows 7 in a vm but it works there as. well.

mynameis...@gmail.com

unread,
Aug 13, 2015, 12:00:48 PM8/13/15
to golang-nuts
visual studio would be OK

在 2011年10月8日星期六 UTC+8下午5:14:05,josvazg写道:

Shawn Milochik

unread,
Aug 13, 2015, 12:04:53 PM8/13/15
to golan...@googlegroups.com
This is one of the most frequently asked and answered questions. You'll get every answer from vim and emacs to Eclipse.

Just use whatever you're most productive in. There is no "best" editor for Go. It's like asking what the best car is. It depends on you and how you use it more than anything else.

Alban Read

unread,
Aug 13, 2015, 2:51:54 PM8/13/15
to golang-nuts

I like the liteide.
I use it on Mac, Windows and Linux.
It provides a nice, fast environment for writing Go applications.
The Go compiler is very fast of course; the editor marks errors from the compiler in the scroll bar so you can find them quickly.
The editor does not check the syntax while you type; it does have autocompletion functions; and updates the import statement for you.
Personally I like using an editor that was not originally developed to work on mini-computer teletypes; and that uses a reasonably standard set of
shortcuts out of the box without having to write any lisp; but everyone has their own tastes quirks and prejudices in these things.

Roberto Zanotto

unread,
Aug 13, 2015, 3:01:50 PM8/13/15
to golang-nuts
Guys, OP just got a Mac in 2011, I don't think he is still looking for a text editor :D :P
Reply all
Reply to author
Forward
0 new messages