Generate some basic boilerplate code for a new Go app
go get -u github.com/Gufran/bleh
bleh!
bleh
bleh!
bleh
generates a bare minimum skeleton for a Go app. It will create a Makefile
, .gitignore
, .travis.yml
along with some build specific information about your app, and configure the build step in makefile to populate
that build specific information.
It will also initialise the git repository for you, add a remote and perform an initial commit.
You can instruct bleh
to not generate that initial commit by including -no-commit
flag.
That is pretty much all to it, I'm sorry if you were expecting unicorns.
bleh
generates 5 files in total. Generated directory structure looks like this
gopath/src/repository/app
|- .gitignore
|- .travis.yml
|- Makefile
|- main.go
|- appname
|- appname.go
Where gopath
is picked up from $GOPATH in shell environment. If $GOPATH has multiple directories you'll be prompted to select your preferred directory.
repository
is the import path for this application, in a typical scenario this would look similar to github.com/your-name
, and app
is the name
of application that you'll be prompted for. Combined this makes up the import name for app i.e. github.com/your-name/app
.
.travis.yml
file is configured to build the application against Go v1.5
appname/appname.go
contains the build information about the app. It includes
- App name - as defined by you
- App version - is generated on build, this is the commit hash on which the build is generated
- App build - is the time of build in UTC
- App build branch - is the git branch on which the build is generated
- Go runtime - version is the Golang version which compiled the application
- App description - is a short description of the application provided by you
It also defines a function to pretty print all this information.
Makefile
, this is the motivator behind bleh
, Makefile defines a bunch of commands and build configuration.
- build - Build the application
- test - Trigger the test suites
- lint - Perform linting
- tools - Install some development related tools
- mocks - Generate mocks and make them available in
mocks
package - clean - Remove generated code, logs, builds and coverage profiles
More commands are available for granular tasks, go through the Makefile to know more about these commands
Although I doubt this tool can accomodate anything else anymore, I'd love to see what you have to offer. Fork the repository, make your changes and send a pull request.
The MIT License (MIT)
Copyright (c) 2015 Mohammad Gufran
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.