Golang Thoughts



Here are my personal likes and dislikes about golang as I learned it and wrote a small microservice in it these past couple weeks. 


 likes

  • small
  • fast
  • type checking
  • composite literals
  • robust initialization
  • robust function type handling (function references/types, closures)
  • more robust variadic function features ("..." operator)
  • easy to write tests
  • robust standard library

dislikes

  • immature language (lots of stuff still in flux and getting changed, e.g. modules)
  • forced brackets on same line
  • names have code effects (capitalized variables and functions are forced to be public NOTE json to struct parsing breaks if fields are not public)
  • comments that have code effects
  • no conditional operator, no preincrement, no increment as expression (eh I guess I can understand why they did this, but it seems hypocritical to me to then allow assignments in e.g. if statements)
  • defer keyword weirdness (only part of the expression is evaluated where you would expect, etc.)
  • no parametrized functions (yet the compiler supports it for the built-in function append()) (not a big deal since we have interface{})
  • import statements tie you to a specific repository

No super great IDE but going with https://github.com/visualfc/liteide for now.

Gorilla has nice mux package for url wildcards, but we don't currently plan to use these as everything will be json params in POST data.

Echo https://echo.labstack.com might be a good option if we need a router later with TLS.

Decided on Redigo for redis go client. Doc: https://godoc.org/github.com/garyburd/redigo/redis Wrapper style example: https://github.com/yadvendar/redigo-wrapper/blob/master/connection.go 

Other options were: https://redis.io/clients#go

Viper github.com/spf13/viper also worked great for me.

Error

default userpic
When you submit the form an invisible reCAPTCHA check will be performed.
You must follow the Privacy Policy and Google Terms of use.