Richard Bucker

bootstrapping go web projects

Posted at — May 9, 2015

At first I thought that this was going to be a good idea. Some sort of opinionated framework was going to bootstrap whatever project I might be working on… and voila. But that was before I started looking at the details and now I have a different opinion.It’s a bad idea to base my next project on this sort of framework.Part of my opinion is intuition and the other part is experience. While the authors have made some excellent choices and they will work in most cases they are not going to work in all cases and without a more general plug-in strategy you’re better off knowing and understanding the ideas and the glue. Implementing your own strategy.The authors have clearly just glued a bunch of 3rd party packages together. It’s not a bad thing but you need to understand the code before you blindly incorporate it. The Go Authors are very clear on this point as the stdlib is fairly feature complete.here is their list and my objections:PostgreSQL is chosen for the database.as much as I dislike CAP there are use-cases for document and key/value storagebcrypt is chosen as the password hasher.crypto is a huge risk for any system; I think bcrypt has been cleaned by the openbsd team so it’s a good choiceBootstrap Flatly is chosen for the UI theme.can’t argue with this as it’s clearly pluggableSession is stored inside encrypted cookie.goodStatic directory is located under /static.okModel directory is located under /dal (Database Access Layer).not certain this is a good idea. models and packages and CRUD are strong ideas but there is something to be said for generators which is missing.It does not use ORM nor installs one.goodTest database is automatically created.mehA minimal Dockerfile is provided.since this is a go program it should have been built on the scratch containergithub.com/tools/godep is chosen to manage dependencies.godep is the current gold standard but gb is on it’s waygithub.com/jmoiron/sqlx is chosen to connect to a database.this is a clear winnergithub.com/gorilla is chosen for a lot of the HTTP plumbings.not a chance.  This is a core and important system. You should implement your own.github.com/carbocation/interpose is chosen as the middleware library.see previous notegithub.com/tylerb/graceful is chosen to enable graceful shutdown.this cannot possibly work properly. Do it yourself and integrate your project with haproxy, vukcand etc…github.com/mattes/migrate is chosen as the database migration tool.schema migration is the hardest part of any deployment. This might be a good tool but it requires some investigation. Commercial ventures make a good living doing this sort of thing.  An open source version of the same quality and versatility would be a great win (depending on the licencing)github.com/Sirupsen/logrus is chosen as the logging library.There are a few missing packages… go-bindata and bindata-assetfs. And a good Makefile/Dockerfile. Taking a page from the Apcera gnatsd project they provided a Dockerfile that is the makefile. The last thing that is missing is a license dependency tree.  Just what exactly are the challenges here… if there is a single license that includes the GPL-A then you have a number of commercial licensing issues. Any corporate attorney would require this evaluation so you are better off doing it for yourself before you get started.Good luck.** know your stack!!!