Go

Is Go (golang) worth learning?

What are the pros and cons?

Other urls found in this thread:

techempower.com/benchmarks/#section=data-r12&hw=peak&test=json
github.com/kubernetes/
google.ca/url?sa=t&source=web&rct=j&url=https://groups.google.com/forum/m/#!topic/golang-nuts/BNUNbKSypE0&ved=0ahUKEwisz_Tqp6nNAhUH9mMKHaPMBjMQFggaMAA&usg=AFQjCNF4ZuCA79SeCltd8kBIzArzeBbKsQ&sig2=k02SXZCGwKCzhjhqzlbnaA
github.com/golang/go/wiki/GoUsers
golang.org
medium.com/@qutheory/server-side-swift-vs-the-other-guys-2-speed-ca65b2f79505
howistart.org/posts/erlang/1
twitter.com/SFWRedditGifs

>pros
native networking built in
>cons
all the cons of C, with none of the benefits

Is the fact that it is so new going to cause any problems learning/using it?

yes, very few people will actually advocate Go because it's too different from C and offers no real benefits over C.

Also, a proper Go book (written by the same guy who wrote the definitive C book) was only published this year.
Not even google uses it in their production systems.

OK, thanks. I'll just go on to learn c or c++ then.

I have heard Google is switching all their servers from python over to go, though.

I have been playing with it a little bit, and it is really fast.

>C
But it's not being made as an alternative to C. It's being made as an alternative to languages like C++, Java or even Node.
C will continue to be used for the low level stuff, and things that require every ounce of performance, but for anything else, there are languages better suited that won't become a pain to write.

So does Go add anything that c++, Java, or node doesn't have?
What is the improvement on these languages?

if you don't know why you should learn it, then don't learn it. It's that simple.

Over Java and Node, there's speed.
Beyond that, Go is designed to be relatively simple, and that's by design.
They didn't try to innovate with Go, by throwing in feature after feature, and forcing people to use every key on your keyboard. Instead its main aim is to write straightforward and maintainable code.

Java is fast these days. It has some weird performance characteristics, but it is not simply slow. JIT compilation makes it faster than optimized C for some tasks.

Node is really fucking fast. It's not general-purpose, but for event-driven I/O it's faster than anything else I know of.

Java is faster than Go in most cases especially when it comes to networking. Netty, Vert.x and Undertow destroy Go's networking libraries in terms of RPS. The main advantage of Go is that memory usage is significantly lower because Java doesn't have value types (coming in Java 10).

yes absolutely.

it's a fast, fun, and productive environment for building cross-platform, memory safe, concurrent software

the culture of the language is heavily influenced by plan9's emphasis on simple, correct software that does one thing well.

although admittedly, there's been a lot of hype these past few years and as a result a lot of awful (and deceptively popular) bad memego has been produced.

but if you read the official docs (golang.org) and heed rob pike's insights you will not regret it.

Yes

Pros
Still niche but big enough to get you a job
Goroutines/channels
The standard library
Good support outside of the standard library
Fills the gap between C and Java
Dem performances
Feels nice to write

Cons
Static linking
Still not C fast
GC (constantly improving, not a problem anymore unless you're writing a game engine or something retarded like that)
>muh generics
lots of if x == nil
lots of functions that accept interface{}, a big source of bugs

>but for event-driven I/O it's faster than anything else I know o

It's not even remotely close to the fastest platform for async I/O. It's only fast compared to other shitty dynamically typed languages like Python and Ruby.

The plaintext and JSON serialization benchmarks at the following link are practically ideal conditions for node and it's nowhere near the fastest.

techempower.com/benchmarks/#section=data-r12&hw=peak&test=json

>the culture of the language is heavily influenced by plan9's emphasis on simple, correct software that does one thing well.
I disagree entirely. The Plan 9 (and UNIX) philosophy is about having things that are modular and extensible. Go is just the opposite. Everything the user makes is a second-class citizen. It is not a small, simple core that makes it easy to re-use and extend code. It's a small, simple core that often makes it impossible to re-use and extend code.

>pros
free ticket for the flavor-of-the-month train ride

>cons
everything else about the language

Latest meme dick that fagrammers are deep throating at the moment. These same pillow-biting brokeback-keyboard cowboys will be writing op-eds about how "they are abandoning go" for medium in like a year or two.

>lots of functions that accept interface{}, a big source of bugs

>not type checking

The great part about the Unix philosophy is that Unix doesn't follow it.

>Not even google uses it in their production systems.
Wrong.

Google deploys and scales their distributed systems using Kubernetes, written in go.
github.com/kubernetes/ kubernetes

dl.google.com was rewritten (from C++) and is now serviced using Go.
google.ca/url?sa=t&source=web&rct=j&url=https://groups.google.com/forum/m/#!topic/golang-nuts/BNUNbKSypE0&ved=0ahUKEwisz_Tqp6nNAhUH9mMKHaPMBjMQFggaMAA&usg=AFQjCNF4ZuCA79SeCltd8kBIzArzeBbKsQ&sig2=k02SXZCGwKCzhjhqzlbnaA

Rather than link more, here's an exhaustive list showing which projects Google uses Go for in production, and other companies as well.
github.com/golang/go/wiki/GoUsers

Not even Google uses this language.

See

>Cons
>Static linking
Yes, it makes the binaries heug, but I like that I can cross-compile for every device I can own, no libraries needed. One single, self-contained binary can have it all.

It's a meme, but it's a nice meme. I enjoy working in Go since I tend to work on things in its niche (Networked programs, terminal-based utilities)

OP, fall for the Go meme. The tour on golang.org is quick and gives you a workable understanding of the language. Even if you don't end up liking it, the tour should only take about 30 minutes.

>all the cons of C, with none of the benefits
it has none of the cons of C with all of the benefits, you have to be a real idiot to think you are going to end up with all the weak typing errors, pointer errors, memory allocation errors, implicit casting errors, etc, etc

>so new
Go is over 10 years old. There are plenty of great resources for learning it.

>few people will actually advocate Go because it's too different from C and offers no real benefits over C.
What the fuck.
>a proper Go book ... was only published this year.
According to... you?
>Not even google uses it in their production systems.
Has your asshole and mouth switched places? I have never seen someone spew so much shit.

>all the cons of C, with none of the benefits
>it has none of the cons of C with all of the benefits
Those are stupid exaggerations. Go is a GCed language with not-so-small runtime complied into every binary it produces. As such, it doesn't have the primary benefits of C (e.g., very predictable performance suitable for hard real-time) but neither does it have the main cons (memory allocations errors).

The runtime is barely 10kb
The size you see is just static linking of the libraries

>The runtime is barely 10kb
>barely 10kb

most micro controllers can't even hold that much

Yeah ok if you're coding for microcontrollers the answer is typically some variant of C. Unless you feel like doing some compiler hacking or your platform's standard toolchain already supports some other language.

Swift kicked the shit out of Go and a few other languages in a benchmark recently

Will see if I can find the link

C kicks the shit out of any other language. What's your point?

Yeah but boilerplate and shit

medium.com/@qutheory/server-side-swift-vs-the-other-guys-2-speed-ca65b2f79505

>C
>boilerplate
Ayyy

I meant if you want to do something like write a restful api you WILL need to write boilerplate, don't even deny it faggot

So Golang's SQLite driver is badly implemented then?

Any language requires you to do that if it's not part of the standard library faggot.

I think the abstraction layer caused the drop in performance.

Some save you a lot more trouble than others, faggot

You're full of shit. It depends on amount of features the standard library has. If don't care writing your own, pick some 3rd party library.

>using a library isn't equivalent to writing boilerplate
Oh fuck you then, make your mind up you silly cunt

So if a REST API is not part of the standard library, it's considered boilerplate? You're a nigger.

I only started learning Go so I haven't got to use it much but why would you use interface{}?

Probably, I wonder why they weren't testing MySQL or Postgres

interface{} is mostly good if you want a function to be able to accept or output multiple types of variables. Thing is, you need to do some type-checking in that case.

> Though they are slower, they are arguably easier to use since the same application can run on different server setups without knowing the number of cores before hand. They also don’t require any external libraries or C dependencies, as almost all operating systems have full POSIX compliance out of the box.
Did this guy really just say pure threads are easier than coroutines? Lmao

(de)serialization of struts. See the json package.

>Google deploys and scales their distributed systems using Kubernetes, written in go.
>github.com/kubernetes/ kubernetes

Wrong. They use Borg for that. Kubernetes is inspired Borg, but not even close in terms of features, stability and adoption.

Well, they apparently use Kubernetes for SOMETHING, seeing as it's listed as one of the technologies that Google uses, written in Golang.

Those benchmarks are pretty awful and in several cases he's running them in DEBUG mode with the hot reloading development servers. What a joke.

Debunk with your own leddit/HN post then

Let's look at the SQL queries being executed.

node:
select * from users where id = ?

Go:
select * from users order by random() limit 1

Java:
select * from users

Gee I wonder why Go and Java aren't performing as well as they should. The queries don't even do close to same thing.

>throwing in a random sort for Go lang, but only return 1
>return all options for Java

Fuck, this is just blatantly dishonest

Yeah I'm not sure if they're purposely being dishonest or they're just incredibly incompetent.

C has no benefits

I think they were just being incompetent.

A lot of the code examples have the same as Go, picking a random entry (which of course results in a sort, if SQL's syntax is to be believed) But then a few of them also do what the Node example does, and selects a random entry through a variable.

The end result (a random entry in the database being selected) is the same, but very clearly the two methods have vastly different performance.

Didn't even notice that. Well then fuck that faggot who did that shitty "comparison".

I'm picking up web dev, coming from making games, sysutils, mathy stuff
Golang or Elixir?

If you like adding the following boilerplate after every single line of code, Go is for you:
result, err = func()
if err != nil {
explode()
}


Otherwise if you like venting gas to prevent explosions, Erlang and Elixir are for you.

howistart.org/posts/erlang/1

>pros
It's great for networking
>cons
So many pain points it's not worth using for anything else