I'm Go Backend developer and love it, Ask Me Anything!

Updated on Aug 10, 2018

Did you find this post useful? Show some love!

Putting "go" word before any function and automatically create a new concurrent task, in my opinion, is awesome. If you want coordinate many tasks you only need think in the flow of your program and implement your own algorithms, but obviously exist a stack library for this work: the fantastic sync library (golang.org/pkg/sync), look at it!

Goroutines are the Go implementation of concurrency.
And you must not compare Concurrency with Parallelism.

Here is a very good video about it from Rob Pike.

And the associated slides (have a look at it, it is very educational) :
Concurrency is not Parallelism

So it is basically using resources efficiently.
Then you can improve the process using parallelism.

So goroutines are basically the Go implementation of concurrency.

I hope that can help.

To add something to my previous comment, I can point anyone that is interested in Go concurrency models and so goroutines to the best article I have read about it from Trevor Forrey on Medium.
medium.com/@trevor4e/learning-gos-...

It is the perfect one if you are not very used to it and want to learn it the easy way.
And then have a look at his other article. They are absolutely great materials about Go.

To me, Go is a kind of letdown because it's neither intellectually stimulating nor widely used. Don't take it otherwise, please: I really admire the language for its simplicity and strictness, but I'm afraid I'm doomed to write PHP and JS for the rest of my life. I actually say this as a freelance dev, because while stuff like Go and Elixir finds good use in product-based companies, those in the service industry must stick to stuff that is "good enough". 😐

P.S.: I thought a lot about not posting this comment after writing it out, but then I felt I should post this. I'm salty about the state of affairs of the development world. The outdated and crappy languages keep getting more and more crutches to make them crawl for another day, while the really good stuff gets ignored. 😣

How did you get into Go development professionally?

I've been in Java land for ~10 years doing mostly backend work, but I've been seeing increasingly more backend jobs using Go so I'm wondering if this is a direction I should start heading in.

I don't have enough experience but I think, apart from its concurrency primitives, some of the reasons to consider Go are: it is quite simple to grasp, fast, has a low memory footprint and any app can be deployed as a single file. Its standard library is quite extensive also.

Go through gobyexample.com/ and see if it peaks your interest.

Ben Halpern DEV.TO FOUNDER

Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. ❀️

Plus, no fake comments when you're signed in. πŸ™ƒ

What sets go aside and makes it unique from other languages? Specifically for backend.
(Excluding that its a functional language)

Its concurrency implementation makes it very easy to write softwares that are very efficient.
And it is a compiled language which means that it is faster than interpreted language.
So if you have to process a ton of data, Go is definitely interesting.
And it is very easy to learn. ;-)

What other languages were you working with before you got into Go?

I love python too, and I had experience with C and C++, I think Go is an awesome language but its program paradigm (without objects and using pointers) needs special attention and concentration.

People say that the Erlang (and Elixir) ecosystems are much more suited (and battle-tested) for building large-scale, fault-tolerant systems. They point to the shared-nothing architecture of Erlang, per-process garbage collection, live code reloading, and the immutability to argue that no other language even comes close. How would you respond to that?

People say that the Erlang (and Elixir) ecosystems are much more suited (and battle-tested) for building large-scale, fault-tolerant systems.

I actually agree with this.

I feel that Go is more suited for things like Docker, where the main requirement is being extremely stable and fast at the same time. For large codebases, it also works really well due to its "stupid" coding style.

For large codebases, it also works really well due to its "stupid" coding style.

I still haven't found the motivation to get past hello world in Go, but this description appeals to me.

Do you think Golang is a good first programming language? For people that have zero experience in development, but would like to understand core concepts of programming they can later apply to other similar languages.

Oh, wow, hard question, really I don't know I think any language is a good language for understanding core concepts of programming because all concepts are similar (like flow control or computer logic). But I accept exist better languages for the introduction to programming mind, (e.g. python) I suppose it is good because of its simplicity and versatility. Go have very intuitive reserved words and that makes simplicity to Go, but also it has deep concepts that you need to practice to master that. Finally, I'm not sure but I think that exist better languages for start to learn programming core concepts, for me that language is python.

Go seems applicable in many fields. Do you think it will become mainstream in areas where there is a de-facto leader today, any time soon? Eg banking and enterprise(Java), DevOps and Machine learning(python), system programming(C++ I believe) or game programming(C# maybe, due to unity)

I've started Learning Go recently. So far, I've written standalone scripts in Go.
How do I go from a beginner to an advanced Go developer?

Really I don't know, probably the experience and the practice is the best options. If you're creating your own standalone scripts I think you only need merge many of these for creating a big application, one pretty idea to make "complex programs" with Go is create a Backend using its "http" stack library.

What's the correct way of implementing Math.round?

Following godoc of this function, Math.Round rounded any float to the nearest integer, rounding half away from zero (golang.org/pkg/math/#Round) and this function only exist from Go 1.10. If you want another more complex unit to round you can implement it.

func Round(x, unit float64) float64 {
    return math.Round(x/unit) * unit
}

fmt.Println(Round(12.3456, 0.01)) // 12.35 
fmt.Println(Round(0.363636, 0.01)) // 0.35
fmt.Println(Round(1.922636, 0.01)) // 1.92

You can round float and obteing a string without function Round, if you want you can convert your string to float later.

s := fmt.Sprintf("%.2f", 12.3456) // s == "12.35"

Here there good references
yourbasic.org/golang/round-float-2...
yourbasic.org/golang/round-float-t...

Oh, so they have added round() to the math library now? This was more of a joke question from my part (sorry). I was remembering a big discussion I read some years ago where the devs behind Go did not want to implement Math.round for some reason, it was pretty funny.

Which orm framework no need to think into owner shoes?
(too many golang framework example is no sense and what you see what you get, can't apply to another case)

I don't understand your question, can you explain to me?. If you're taking about ORMs in Go, personally I use one called Storm, an ORM for BoltDB (BoltDB is an awesome no relational database written in go).

some framework documents like this

Only show how to define/declare

you need to think as that developer think how to use it

What are the advantages (of any type) in using Go instead of other languages, like Python, Ruby or PHP?

It depends, for example, I can't use Go for machine learning or mathematical computing (not because this is impossible with Go, because exist more suited tools), I think Go is awesome because is simple and fast and have an ecosystem based on the web (a lot of frameworks like Gin Gonic, Iris go or if you want to make JS with Go you can with GopherJS or Joy). I don't use Python for backend dev, because is not ideal for this task, I prefer more control and versatility and Go, for me, it provides this.

How many code generators do you have to write on a daily basis? ;)

How do you structure your code (what do you split up in packages, what do you split up into files, etc...)

Do you use a framework? Which one?

Generally I try to struct my project of different ways each time, below you can see two different projects and in the first I don't use folders, I only split my project in different files, in the second image I use folders for each part of the project (this project was really big), if you want see more, you can see in my github account, there I have different projects and you can see all the code.
way1
way2

Classic DEV Post from Aug 3

Keeping up in the JavaScript world πŸƒβ€

JavaScript fatigue has been on the rise for a while now. You often hear develop...

READ POST
Follow @superkarolis to see more of their posts in your feed.
dev.to is now open source!
View Announcement Post View GitHub Repo
Bregy Malpartida
I'm Bregy and love to create new tech, hardware, software and science, my big passion is the artificial intelligence and the data science. Stay open source.
Trending on dev.to
What is your approach to learning a new Javascript framework?
#discuss #learning #vue #javascript
I am a JavaScript's biggest fan, Ask Me Anything!
#ama
Open Source Has Not Failed. Don't Cover Up Corporate Abuse of Open Source
#opensource #technology #career #rant
Why haven't you gone to a development conference?
#discuss #webdev #conferences
Understanding Object Oriented JavaScript
#javascript #beginners #webdev #discuss
We Might Face The Crisis of Creative People in Next Few Years as our young generation is stuck in Just Googling Things
#discuss #crisis #humanity
I teach web development in college and have done so for 10+ years to 500+ students. AMA!
#ama
I'm a dev who has a vision for a new internet. I've even started building software, Ask Me Anything!
#ama