Prysmatic Labs sticks to the official Effective Go guidelines, and all code committed to Prysm's master branch goes through extensive lint tools that check formatting correctness and review potential security flaws in the code itself.
For a recommended book on the Go language, see 'The Go Programming Language' by Alan A. A. Donovan and Brian Kernighan, available for purchase on Amazon here.
Prysmatic requires all code to adhere to correct commentary conventions for any new packages in order to generate proper Godocs.
Ensure your names are clear, concise and make no assumptions about your code without explaining the surrounding context with good commentary. Additionally, ensure all variables are namespaced properly and have a clear purpose to the reader of your code.
Bad (uses magic numbers with no explanation or context):
Always handle fatal situations gracefully through informative error messaging or logging. Error handling is critical in code paths where critical state mutations occur which affect data persisted to disk. In particular, not handling an error gracefully a few lines above where data is written to disk can cause the system to remain in an inconsistent state (one of the most critical types of failures).
Instead, ensure to handle all errors in critical code paths appropriately. The error above can easily be fixed by a
continue line added after the
log.Errorf call to continue the loop and not store a bad state to disk.