Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
Last active February 6, 2020 22:37
Show Gist options
  • Save StevenACoffman/008e86dde45cf1fe27f4092ff20316a6 to your computer and use it in GitHub Desktop.
Save StevenACoffman/008e86dde45cf1fe27f4092ff20316a6 to your computer and use it in GitHub Desktop.
Why Golang?

Why invest in golang:

Energy Time Mb
C 1.00 C 1.00 Pascal 1.00
Rust 1.03 Rust 1.04 Go 1.05
C++ 1.34 C++ 1.56 C 1.17
Ada 1.70 Ada 1.85 Fortran 1.24
Java 1.98 Java 1.89 C++ 1.34
Pascal 2.14 Chapel 2.14 Ada 1.47
Chapel 2.18 Go 2.83 Rust 1.54
Lisp 2.27 Pascal 3.02 Lisp 1.92
Ocaml 2.40 Ocaml 3.09 Haskell 2.45
Fortran 2.52 C# 3.14 PHP 2.57
Swift 2.79 Lisp 3.40 Swift 2.71
Haskell 3.10 Haskell 3.55 Python 2.80
C# 3.14 Swift 4.20 Ocaml 2.82
Go 3.23 Fortran 4.20 C# 2.85
Dart 3.83 F# 6.30 Hack 3.34
F# 4.13 JavaScript 6.52 Racket 3.52
JavaScript 4.45 Dart 6.67 Ruby 3.97
Racket 7.91 Racket 11.27 Chapel 4.00
TypeScript 21.50 Hack 26.99 F# 4.25
Hack 24.02 PHP 27.64 JavaScript 4.59
PHP 29.30 Erlang 36.71 TypeScript 4.69
Erlang 42.23 Jruby 43.44 Java 6.01
Lua 45.98 TypeScript 46.20 Perl 6.62
Jruby 46.54 Ruby 59.34 Lua 6.72
Ruby 69.91 Perl 65.79 Erlang 7.20
Python 75.88 Python 71.90 Dart 8.64
Perl 79.58 Lua 82.91 Jruby 19.84

Le Stum says the strength of Go include its built-in tooling, quick compile times and deploys, and easy troubleshooting, as well as the way it makes code easy to understand. "In Python, you could write super-elegant list comprehensions and beautiful code that's almost mathematical. But if you didn't write the code, then that elegance can come at the expense of readability," he explains, noting that in enterprise software, engineers spend more time reading code than writing it.

Salesforce principal architect Guillaume Le Stum

Go is good for Scripting:

You can make go source code executable like this:

///usr/bin/env go run "$0" "$@" ; exit "$?"

package main

func main() {
    println("Hello world!")
}

Then I can just chmod a+x hello.go and execute ./hello.go. More options at https://gist.github.com/posener/73ffd326d88483df6b1cb66e8ed1e0bd

Unix pipes are awesome. Go scripts can use them like one of these:

This is an interesting way to package multiple scripts into one directory: https://github.com/jpignata/toolbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment