Skip to content

Latest commit

 

History

History
26 lines (24 loc) · 3.38 KB

README.md

File metadata and controls

26 lines (24 loc) · 3.38 KB

golang gotchas

Anything I didn't know about golang and is somehow special to golang for me with programming background in Java, Python, Groovy, C, C++ and misc other programming languages

Maybe it helps others starting to use golang :-)

  1. acceptLanguage - Sample using golang.org/x/text/language to select the correct language from HTTP Accept-Language
  2. broadcastChan - Sample how to implement simple broadcasts
  3. compareMaps -Typical pitfall when comparing map elements
  4. copyStructs - Sample code using github.com/jinzhu/copier to copy structs
  5. debugHTTPClient - Sample code which uses httputil to get low level debugging of http clients
  6. errorMarshaling - Sample code hoe marshaling of errors works
  7. fetchUrls - Use gofuncs to execute get requests against a number of urls and calculate responsetime statistics
  8. github - Retrieve all public repositories of a github organization with a home grown client or a client using the google go-github library
  9. gorohttp - Simple sample code how to kick off http requests as fast as possible
  10. httpStress - More complex sample code how to kick off http requests as fast as possible
  11. httpClient - Sample how to use timeouts in a httpClient
  12. i18n - Sample code using github.com/nicksnyder/go-i18n/i18n to enable localization
  13. jsonMarshalling - Print the different marshal/unmarshal results of different structures into/from JSON
  14. logging - Sample code using go.uber.org/zap to create structured logs and use log hooks
  15. pointers - Sample code to demonstrate a common error using pointers in golang when you are used to use C or C++
  16. pollURLs - Golang pollURL sample code
  17. sigTerm - Catch SIGTERM or SIGINT to gracefully shutdown program
  18. templates - Sample code using golang /text/template
  19. utils
    1. json.go - pretty print JSON
  20. waitGroupTimeout - Sample which implements a waitGroup which can timeout