DEV Community

Golang, it was love at first sight.

Adrian B.G. on September 18, 2018

The article was originally posted on my personal website https://coder.today/go-go-go-flash-bang-d66f4c42eb7c. Meanwhile I have developed a few li...
Collapse
 
bgadrian profile image
Adrian B.G.

Ah yes, sorry about that. I think I used the wrong words, is not that I changed my mind, but I can add more details or debunk some of the ideas. At a first glance:

It has identity & a cool mascot

Gophers are cooler than I expected, I even made one

We like to work with JavaScript (building an API is easy or they can be complementary)

I didn't found any support for this, it supports the same features/frameworks like most popular web languages: a template system (builtin), Go-JS compiler, Go-WebAssemly compiler (builtin), but nothing special.

We like to multi taskand work with big data.

I didn't realized the scales of the projects where Go is used, and at what stack level is used. I have found important, latency and HA sensitive projects, I don't have time to put the links now but the resources are out there, a few examples are: Dropbox new storage system, Kubernets and Docker, Consul, DGraph, CockroachDB, terraform, Cloudflare analytics and othe systems ...

Community β€” after more than 60 hours of conferences panels and reading forums I can say it is a nice community.

Is an understatement, I found the community to be great, especially the Slack server.

I have found some limits, or downsizes:

  • intensive realtime, time sensitive apps is kinda cumberstone because of the lack of memory management, but I saw some talks, so they can be done but is harder
  • the builtin web server tools are too simple and don't have the proper default settings to be used in production, if you don't use a framework or some modules you will end up writing your own (like GorillaMux for routing)
  • Package management, Generics and error handling are the top 3 problems in Go and they are taking care of, in the next Go versions
  • Concurrency paradigms are not so easy to understand (is not related to Go, is just a new way of thinking), but are very easy to implement in Go.

Overall I still love it, I even have a personal goal to be an expert in Go in a few years, is a language that doesn't lie, WYSIWYG, simple, pragmatic and efficient.

Collapse
 
biros profile image
Boris Jamot ✊ /

Go 1.11 brought the concept of modules that allows to resolve the package management issue, like npm or composer.

I think that Go is production ready for many purposes as it's getting more and more used in software industry (elk beats, docker, openshift...).

Thread Thread
 
bgadrian profile image
Adrian B.G.

Go modules are not ready yet, after the need of /vendor dissapear then it will be ready.

I know about them, I even read the original longgg VGo articles and I love the idea. Coming from a NPM nightmare projects where errors and random builds occurs is going to be a bless to work with go modules.

Thread Thread
 
biros profile image
Boris Jamot ✊ /

I don't know much about Go and modules but I know we use it in my company for a big project. And yes, I noticed that /vendor was committed and my eyes started to bleed ☺️

Collapse
 
ahmadawais profile image
Ahmad Awais ⚑️

Can you share with me what is the immediate benefit of Go for a frontend dev? Where can I use it immediately? I loved it at first sight but couldn't find a thing to do with it. That has to do with small businesses.

Collapse
 
bgadrian profile image
Adrian B.G.

Immediately usage is none for a front-end dev, maybe:

  • WebAssembly if you have to write performance based front end library.
  • make your own back-end stubs/small services

But ...

I (and others) suggest to learn a new programming language each year, at least at the beginner level. 30 hours per year is a small price to pay for the advantages. It will change how you think about programming, learning new paradigms, constructs that will enlarge your horizons and make you a better developer.

Collapse
 
ahmadawais profile image
Ahmad Awais ⚑️

I do do that. I am failing to find a project to work on with Go. I don't believe in learning for the sake of learning. I learn to produce production quality software. So, that's why I asked :) I enjoyed Go a lot.

Thread Thread
 
bgadrian profile image
Adrian B.G.

What are the top 3 problems you face when building websites, what will make you to be more productive, efficient or your projects performant?

Choose a problem and build a solution, or contribute to an already made one. I'm sure that your problems are similar with other front-end devs aswell.

Collapse
 
itsdarrylnorris profile image
Darryl Norris

One project that can be considered "front-end" is Gohugo. Gohugo is a static website generator is pretty cool. However, GoHugo uses their Golang templating language, which is pretty weird(or different from other templating languages out there).

Golang can be used to create API's to build your front-end or even server-side rendering.

I am not sure if that answer your question or not.

Collapse
 
ahmadawais profile image
Ahmad Awais ⚑️

That's exactly what I tried to do. Haha. I built my last talk's slide with Go Hugo. wordsesh2018.ahmadawais.com/

Honestly, it felt a bit hard to do as compared to using Gatsby which is written in JavaScript/React.

Thread Thread
 
itsdarrylnorris profile image
Darryl Norris

I can see why making a slide using GoHugo will be painful. GoHugo seems to be targeting more plug and play website tool with possibly a lot of content creation. Compare Gatsby, which more like a framework build static website generators.

Collapse
 
scovl profile image
Vitor Lobo • Edited

A simpler way to create a generic golang project that makes more sense than using the go mod init name command, is here:

Into ~/.bashrc or ~/.zshrc

#Create Go project
goproject () { mkdir -p $1/{src,bin,pkg,vendor} && touch $1/main.go }

And now, use the command

goproject example
Collapse
 
redeving profile image
Kelvin Thompson

Thanks, this is great for me since I'm a Go newbie. However, I kept getting a bash error:

syntax error: unexpected end of file

I had to add a semi-colon after after main.go so the parser didn't keep going insane. I'm running LMDE4.

Original: #Create Go project
goproject () { mkdir -p $1/{src,bin,pkg,vendor} && touch $1/main.go }

No Error:#Create Go project
goproject () { mkdir -p $1/{src,bin,pkg,vendor} && touch $1/main.go; }

Thanks again! Cheers!

Collapse
 
debugging profile image
Salman Ahmed

I love the simplicity of Go also, especially coming off a scala project.
I have to say I sure to miss the rich collection library of scala (and even c# for that matter).
In the end being able to write and read other developers code has given me allot of inner peace.

Collapse
 
bgadrian profile image
Adrian B.G.

You will see that rich frameworks and libraries will appear to Go too, but I hope not in the same way.

Being at a lower level of abstraction than C#/Java, to keep performance in the top priorities we need to see, know and understand what each function call does. It is hard to do that if you use a library with 20 levels of inheritance in 200 files, or worse, letting the ORM generating queries for you.

Collapse
 
debugging profile image
Salman Ahmed

Agreed. Being able to understand the code from your dependancies can be as important to understand as your own code when dealing with production issues. You own all the code when something is down.

Collapse
 
revskill10 profile image
Truong Hoang Dung

What Go can do that Javascript/NodeJS can't ?

Collapse
 
bgadrian profile image
Adrian B.G.

This post is about my subjective passion for Go, but I can be objective too to answer your question. I'm sure others provided better answers but I'll try to sum it up in a few examples.

Basically you can see Go good for building databases, proxies, servers and CLI tools, while NodeJS keeping the business logic and websites.

Sure there are things that NodeJS can do and Go cant! I even keep a list of how many things JS can do nowdays and is getting bigger every month!

I even see them complementary in mid/large size products and teams. If you already have a NodeJS large app you can extract the golden paths that needs to be fast responsive in small go services, keeping the benefits of both languages (like finding developers).

For me personally, after 8yrs+ of JS (not node) in production I can say Go brought me inner peace, stability, solved many engineering problems I faced in real products and simplify the entire building process while making faster and more resilient apps, with only a few keywords. Is not the holy grail! it is just better for me and it suites my next career needs.

Collapse
 
quii profile image
Chris James
  • It's simpler to read and write
  • Better tooling
  • Easier to ship
  • Generally will perform better, especially on CPU bound tasks