http.HandlerFunc turns ordinary functions into http.Handlers
Use httptest.NewRecorder to pass in as a ResponseWriter to let you spy on the responses your handler sends
Use http.NewRequest to construct the requests you expect to come in to your system
Using interfaces and mocking allows your to start coding in small steps. Because you don't need to create large requirements (like a db) and focus on the logic.
TDD to drive out the interfaces you need
use http.NewServeMux() for routing
use Type embeddingto compose new structs or interfaces. Should only expose what's appropriate
use encoding/json to serialize and deserialize json
Seeker interface to go to beginning of file
sort.Slice for sorting slices
os.File to handle files, Truncate to change size of file
os.Stdin and bufio.Scanner to read from standard input
test using mypackage_test package name to see how others use your code
export test helpers and stubs to make them easier to use and allow others importing the code easier ways to test
update package structure to include folders for each separate application. reuse domain code by importing module
time.Afterfunc: scheduling a function call after a specific duration
time.After(duration): returns a chan Time when the duration has expired. So if you wish to do something after a specific time, this can help.
time.NewTicker(duration): returns a Ticker which is similar to the above in that it returns a channel but this one "ticks" every duration, rather than just once. This is very handy if you want to execute some code every N duration.
separation of concerns: separate the responsibilities of dealing with user input and responses away from domain code
messy tests
If your tests look messy try and refactor them
If you've done this and they're still a mess it is very likely pointing to a flaw in your design
function implementing an interface:
When you define an interface with one method in it you might want to consider defining a MyInterfaceFunc type to complement it so users can implement your interface with just a function.
In Go you can add methods to types, not just structs. This is a very powerful feature, and you can use it to implement interfaces in more convenient ways.
user helper functions to retry assertions and add timeouts
use go routines to ensure the assertions don't block anything and then use channels to let them signal that they have finished, or not