Golang
Memory usage can be retrieved using
runtime.ReadMemStats()
(Sample Gist)Avoid moving data to the heap for a performance improvement. When assigning variables, if you can work with the reference to your data rather than copying it out, that reduces heap usage.
Compile your code with the
-gcflags=-m
look for occurrences ofmoved to heap
. See if you can avoid that. (source, HN)
Learning Resources
- Effective Go
- Hasn’t been updated since 2009, but the core concepts still remain. Does not
account for things like
go mod
or any of the new language features.
- Hasn’t been updated since 2009, but the core concepts still remain. Does not
account for things like
- Learn Go with Tests
- Building a BitTorrent client from the ground up in Go, Jesse Li (HN)
Useful Frameworks
Useful Libraries
- cobra: CLI apps made easy
- ent: Entity framework for Go
- gin: HTTP library
- migrate: Database migrations
- viper: App configuration via files and flags
- By Charm:
Database Libraries
- DB2:
- MSSQL:
- denisenkom/go-mssqldb
- microsoft/go-mssqldb: Microsoft fork of the original project made by denisenkom