HACKER Q&A
📣 mr_krinkle

SWE Infrastructure – Should I Learn Go or Python?


I've been working in the Infrastructure side of the stack for the past two years.

I'm really enjoying building tools that allow operations to provision/automate infrastructure in the cloud.

I'd like to explore this area deeper. I've noticed Infrastructure tools are typically Python or Go.

Is there a language preference between the two that I should be focusing on in terms of career growth?


  👤 eb0la Accepted Answer ✓
Both of them.

I expect some Python code we've got around will be ported to GO as soon as we need to reduce our cloud bill on some services.

I see Python is becoming a the new Basic and the new LUA: - It is easy to code. - It is used to orchestrate lower-level stuff with a high-level (understandable) interface. - You can type the script on a REPL and copy-paste to an editor. I know, this doesn't look like coding, it's dirty, but it works.

If you're into containers, cloud functions (or openfaas) and k8s, use GO. Advantages: - Faster than Python. Both startup time and runtime because it is compiled. - Since it is compiled, you will catch errors on development that would be Python runtime errors. - Good for responding to K8s triggers, cloud functions, Knative containers (cloud run) without having to pay too much for running them.


👤 potta_coffee
I've been a Python dev for years now, recently picked up Go to meet some of the deficiencies in Python. You should learn both, they're both invaluable. If you're completely new to programming, I'd start with Python (just an opinion). I think it's easier to learn and there are more resources.

👤 neduma
Bash, Python, Go would be my order of preference. Although C, gcc, libc, make tool chain makes more sense if you're into os/kernel/networking areas.

👤 johnjungles
Both! Python will probably help you build concepts faster and iterate quickly, but golang has much better performance (given you understand how to do this).

I would pick your battles and do things that are actually relevant. For example if you need something that requires high performance because of a bottleneck, do it in Go. If you need a simple server to test if something you’re thinking would work or if Python has better packages use that.

If you really have to pick one to focus on, I would understand the trade offs then pick. A lot of infrastructure code nowadays like kubernetes are written in go, but are you looking to contribute to that ecosystem? Or are you looking to be an automation master connection a whole lotta pipes together?


👤 7532yahoogmail
You learn both! It's not a big ask. But GoLang will be superior for any multi-core, multi-threaded work. And it deals with C libs easily. Others mention bash like it's an option. No, it's a forgone requirement to basic development. A developer should be at home on a CLI.

👤 gtirloni
What's your infrastructure stack? You need to evaluate the availability of SDKs and others.

For example, if you want to use Pulumi, I think they still don't have a stable Go SDK.

Likewise, if you're using Ansible, it's easier to hack on it with Python even if some things are language-agnostic.

Like others said, learn both.


👤 ldoughty
Building infrastructure in the cloud? If you're talking about standing up AWS/Azure/GCP, I don't think Go has much for libraries to support that yet...

For career growth in that space, I'd learn the proprietary deployment mechanisms they each have... I've used ansible for 2 years in cloud infrastructure, and honestly I found it frustrating. I'd only use them to deploy cloud-specific templates now.

For infrastructure, python is probably better of the two languages... Unless by infrastructure you mean writing the connectors between a cloud database and a performance-sensitive application.. in which case Go should give better performance if tens of ms matter.


👤 drallison
I guess I am an outlier. You should learn both languages and any other you encounter. Learning a programming language (after the first few) is not particularly difficult. Each language gives some small insight into how a program (or programs) can be structured. It pays to learn a few assembly languages as well to learn how abstract programs can be mapped onto hardware. Focusing on a particular language to enable career growth is not rational behavior.

👤 geoelectric
I've seen a reasonable amount of infrastructure work in node too, at this point.

My basic take right now is that service-based infrastructure is probably going to favor Go (or node).

Infrastructure that's not accessed directly as a server (kicked off from a separate CI tool or whatever) has a lot of Python representation.

Which side interests you more? Personally I wouldn't be thinking either/or for any popular language or stack, more like 80/20 and what should be my 80?


👤 acejam
Bash, Python, Go - in that order.

👤 BrandonBradley
Go might be useful since Terraform uses Go.

Try to focus on what your shop has already. Solve their problems first.

I'm joining a shop in the new year that was impressed by my use of the Serverless framework. Impress them.


👤 neizd
Python is long established language, GoLang is gaining traction I think both are worth learning, especially that they are so different.

I would try both and just stay with the one that feels better to use.


👤 wprapido
Assuming you know Bash already, Python first and Go second. On a sidenote, I came across lots of NodeJS infra stuff as of lately.

👤 pageandrew
Learn both, and choose whichever makes most sense for the task at hand. Neither are that difficult.