Giter Club home page Giter Club logo

gomk's Introduction

GoMk

An opinionated Makefile for Go projects.

Use cases

  • How would you implement a building workflow using Go alongside other technologies?
  • Do you remember how to run the commands to check the test coverage of you Go project?

Usage

  • Download go.mk to your project:
curl -O https://raw.githubusercontent.com/hgfischer/gomk/master/go.mk
  • include go.mk in a new or existing Makefile;
  • Check Makefile.sample to see some examples on how to integrate with your own build workflow:
curl -O https://raw.githubusercontent.com/hgfischer/gomk/master/Makefile.sample

How it works

GoMk defines default variables and targets for a Go project, to help maintain a healthy project. It also checks your current Go environment.

Predefined variables

  • APPBIN: name of the application, based on the repository name
  • GOSOURCES: all .go files inside the project repository
  • GOPKGS: all Go pkgs inside the project repository

NOTE: Check the go.mk file for other predefined variables that may conflict with other variables defined in your Makefile.

Predefined targets

  • gomkbuild: build the application binary, if there is one
  • gomkxbuild: build all cross-platform binaries, using gox
  • gomkclean: clean the project directory of the files produced by go.mk
  • gomkupdate: update your go.mk file
  • vet: run go tool vet in each source file
  • lint: run golint in each source file
  • fmt: run go fmt in the entire project
  • test: run go test for all pkgs in the project
  • race: run go test with race detection in all pkgs in the project
  • deps: install all deps needed by the project
  • cover: run tests with coverage report in all pkgs in the projects
  • printvars: print all variables defined in the Makefile

Godep support (optional)

  • savegodeps: save all deps with godep
  • restoregodeps: restore all deps with godep
  • updategodeps: update all deps with godep

TODO

  • Add targets for other tools
  • Add support for gb

gomk's People

Contributors

hgfischer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gomk's Issues

Assume a GOBIN path

As a usual Go user, I do not have my GOBIN environment variable set and the makefile will bomb out when used vanilla and that's probably going to happen on usual configurations where the source is distributed.

Instead of bombing out with an error, it may be safe to assume GOBIN="$GOPATH/bin" when GOBIN is unset. This would make the Makefile act more in line with what the go tool does.

Make error: target doesn't contain pattern character (%)

I''m running on Mac OS X Yosemite 10.10.2 and I get an error when I run the Make command.

$ make 
$ go.mk:141: *** target pattern contains no `%'.  Stop.

Line 141 contains $(PRESENT) : ; @go get -v golang.org/x/tools/cmd/present, but I don't know how to go about this. I tried both Make versions 3.81 and 4.1 and the error still persists.

Thanks!

Support automatic rebuilds

"Seth W. Klein [12:15 PM]
i want to run a command that stays running and rebuilds whatever needs it whenever i save a file

"Herbert Fischer [12:16 PM]
It's possible to do something like this using make. Just file an issue."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.