I disagree with some of the points: *Structured logging* - It depends on the context. Unnecessary information may obscure the clarity of the log message. *Use assert-libraries* - Okay, but not necessary. I would avoid depending on too many third party libraries for better stability (your code do not get broken by third party libraries) and portability (sharing code with others where others may not have access to the same third party libraries). Not to mention the licensing issue as well if you are doing commercial app. *Avoid mocks* - Disagree. Mock leads to shorter test code, which is easier to maintain. It is also often not possible/practical to set up an actual environment in order to test a small part of the code. *Avoid testing unexported funcs* - There are times when white-box testing is necessary. For instance, I have unexported functions form the critical part of the application. It is safer to test them in isolation (to make sure they are really robust) than to test them when there are many other things going on. *Avoid side effects* - Functional Programming stuffs. I'd say it depends. FP is not exactly the silver bullet to programming. *Favour pure funcs* - Another functional programming stuffs. Umm.. *Don't over-interface* - Disagree. I say use the correct level of abstraction for your domain. *Don't under-package* - It depends. Just organize your project so that it is intuitive to the new guy. *Use canonical import path* - It's more trouble that its worth. When you need to reorganize your code, you need to update those comments as well. It leads to more maintenance. *Avoid empty interface* - Empty interface{} is useful. It often leads to simpler design. Sometimes, you have no other choice. *Use functional options* - It depends. Options can also be represented with plain structs (data) and objects (function + data), rather than just function. Use whatever is simpler. Sometimes it is simpler to provide no option at all.
On Monday, July 31, 2017 at 11:15:18 PM UTC+7, ha...@arne.me wrote: > Hey, I just released a Go Styleguide > <https://github.com/bahlo/go-styleguide>, please let me know what you > think! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.