
Official Go support - gdb
https://stripe.com/blog/official-go-support
======
fizixer
Can someone explain?

I'm a big fan of C and python and I've never used Go. My initial impressions
from readings were that Go is a better C. But then I came across a Go person
who was lamenting that misunderstanding and that Go is python but with better
performance. What's it all about?

Also even if we compare it to C I don't like the garbage-collection thing at
system level. Also what does Go let you do in terms of garbage collection that
cannot be done with a C gc library (which anyone can use if they want but then
also have the choice to do raw/manual memory management if they want too).

~~~
methodology
Go's syntax and semantics seem ad-hoc, hard to remember, and inconsistent, but
that's because Go was designed from uses cases and experience by prominent
thought leaders such as Rob Pike and Ken Thompson, and Google. For example,
sometimes you'll get Unicode code points, but sometimes you'll get bytes of
UTF-8. The language was designed to give you the right one in the right case.
UTF-8 is coupled with the language because it's the most useful choice.
Another example is that pointers are automatically dereferenced, but not when
you have pointers to pointers, because that's less useful. If any thread runs
in an infinite loop that doesn't call built in functions, the entire runtime
will freeze. But this is by design. You're meant to do actual useful stuff in
your loop such as calling IO functions (which will yield to the scheduler) or
calling GOSCHED.

It was designed to compile fast, and compiles faster than most languages and
still has near C-speed. It doesn't have a GIL so it has better concurrency
(Java style memory model). It has no complicated features like generics,
instead you just use type assertions when you need. It also has impeccable
tooling.

~~~
bad_user
> _It doesn 't have a GIL_

On platforms like Go and the JVM, the garbage collector acts like a GIL, which
is why they'll never replace C/C++.

~~~
jesstaa
Most concurrent C programs of a reasonable size eventually have some kind of
big global lock. The linux kernel had one for a long time and it took a lot of
effort to add more fine grained locking. Similarly most large C programs have
a garbage collector of some kind.

~~~
pjc50
_most large C programs have a garbage collector of some kind_

[citation needed] - the vast majority of Linux software is C or C++ and I
can't immediately think of any with GC. It's not normally assumed, everyone
does explicit deallocation, possibly ending up writing their own slab or pool
allocators.

------
pavanky
Guys slightly off topic, but please do keep the colorblind people in mind. The
colors used for the graphs are so similar that I can not differentiate them.

~~~
fossuser
Interesting - I thought it'd be red/green, but it's blue/purple (which I
thought were colors chosen for the color blind).

Is blue/purple color blind less common? Can you differentiate between
red/green?

~~~
Sanddancer
If you're red-deficient, then purple/blue is also a bad choice for colors
because you can't see the red components of purple.

~~~
pkulak
Blue and purple are the same color as far as I can tell.

------
cnbuff410
It's both interesting and suprising that how steady this exponential growth
curve is. The increasing speed of Go usage on stripe doesn't slow down as time
goes by.

Of course without knowing the base we don't know how big usage it actually is,
also we don't know if it's counting one-per-client or one-per-request. Still
nice to see that nonetheless.

~~~
darren2000
Right, just look at August! Although I wish there were numbers on that graph.
Was there a conference talk? Glad to know there'll be lots of fellow devs
using it anyway.

------
masklinn
Interestingly, it looks like the Go library uses structs rather than
`map[string]interface{}`, even though the Java library was recently criticised
for its usage of `Map<String, Object>`[0], a decision defended by the
developer[1] on grounds that "[they] add new parameters to the API frequently,
so it's a tradeoff to avoid devs needing to update stripe-java every time."

[0] [http://movingfulcrum.tumblr.com/post/97624791473/critique-
of...](http://movingfulcrum.tumblr.com/post/97624791473/critique-of-stripes-
java-apis)

[1]
[https://twitter.com/JimDanz/status/511730705387110400](https://twitter.com/JimDanz/status/511730705387110400)

~~~
ericwaller
Go's JSON parser ignores fields that aren't present in the destination type,
so the addition of new parameters shouldn't be a problem.

~~~
rsanders
I believe the issue is that new parameters wouldn't be accessible without a
library update.

~~~
djur
My sense is that the Go developer culture is a lot more open to frequently
updating their dependencies than the Java developer culture. Fetching
dependencies from git is built into Go, after all.

------
seansh
What language/platform were you using that had "2-4x" lower throughput than
the port to Go?

~~~
gdb
That was porting from Ruby. Go is particularly good for any application where
you want to get better utilization out of your CPU, or want to cut down on
memory usage.

Most of the code we've been porting has been infrastructure: parsers, reverse
proxies, and the like. We're still getting a feel for what it's like writing
complex application logic in Go, but what we've seen so far has been
promising.

------
jrobn
Official lua support would be peachy.

~~~
rurounijones
Out of curiosity: Where would this be used? The only places I ever hear the
word "lua" being used are with "embedded in a game as a scripting language".

Is this the case here? Does lua have a lot of use elsewhere?

~~~
jrobn
Lua is compiled into OpenResty (NGINX). There is also a nice webframework
called Lapis thats built on top of openresty and lua.

~~~
rurounijones
Thank you for the information!

------
linguafranca
I'm a bit baffled by Go.

The majority of developers I know (across several camps) strongly oppose Go,
often to the point of ridiculing it.

But then I see Go support being added to everything, usually by a few key
people who strongly prefer it. In fact I hear Heroku is internally adopting Go
pretty rapidly.

So every time I see an announcement like this, I look up whether Go has added
some kind of generics yet. And as usual, they haven't.

But to me, the worst part of this is that the whole community has Stockholm
syndrome, being perfectly content to instantly defend every position the Go
team makes, no matter what.

~~~
shadowmint
I'm not the greatest fan of Go; the pain points of api weirdness and generics
are too irritating for me.

...but you've got to admit: look at the graph. That's an exponential increase
in people using go to access the service.

If you're a service based company you can't just ignore the people who use
your service.

If people are using go? Provide a go library.

If you see an exponential curve of people accessing it using lua, write a lua
library.

It's pretty obviously the right thing for them to do.

~~~
general_failure
The graph has no numbers.

~~~
NateDad
Developers & managers at Stripe decided that Go was being used often enough to
spend precious dev time writing an official library which will have to be
supported from here on. They wouldn't do that if the numbers didn't justify
it.

~~~
general_failure
That does not justify a graph with no numbers.

