Skip to content

A collection of best practices for writing web apps in Go

License

Notifications You must be signed in to change notification settings

gdeupree55/go-best-practices

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Best Practices

A collection of things I consider to be best practices in test-driven go development. This applies mainly to writing applications in Go, in particular JSON APIs, but can be extrapolated to command line tools, libraries and framework too.

This was inspired by Can Berk Guder's iOS best practices repo.

Practices and Principles

Some of the practices and principles I tried to demonstrate in this sample project are:

TODO

  • main.go
  • gvt
  • webserver with /pizza/order route
  • order pizza use case
  • pizza repository
  • wire up /pizza/order to usecase
  • minimal gexec test
  • gexec test asserts we can make a single http request
  • middleware (composition)
  • logging
  • stats ?
  • configuration (port, log server, stats server)
  • panic handler (middleware?)
  • find a better name for "domain" package (h/t to Dave Cheney)

#notes

  • I prefer using gvt to manage my dependencies, but you may prefer godep, or just doing it by hand. So long as you keep your dependencies tracked, make it easy to setup new development environments and bump dependencies regularly, you should be fine.

About

A collection of best practices for writing web apps in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.7%
  • Shell 0.3%