-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: Improve makefile commands and fix lint
Improved the makefile for making the development more easy and fixed the issue returned by linter. Added the contributing file.
- Loading branch information
Showing
5 changed files
with
135 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Contributing | ||
|
||
By participating to this project, you agree to abide our [code of conduct](/CODE_OF_CONDUCT.md). | ||
|
||
## Setup your machine | ||
|
||
`cachego` is written in [Go](https://golang.org/). | ||
|
||
Prerequisites: | ||
|
||
* `make` | ||
* [Go 1.8+](https://golang.org/doc/install) | ||
|
||
Clone `cachego` from source into `$GOPATH`: | ||
|
||
```sh | ||
$ mkdir -p $GOPATH/src/github.com/fabiorphp | ||
$ cd $_ | ||
$ git clone [email protected]:fabiorphp/cachego.git | ||
$ cd cachego | ||
``` | ||
|
||
Install the build and lint dependencies: | ||
```console | ||
$ make depend | ||
``` | ||
|
||
A good way of making sure everything is all right is running the test suite: | ||
```console | ||
$ make test | ||
``` | ||
|
||
## Formatting the code | ||
Format the code running: | ||
```console | ||
$ make fmt | ||
``` | ||
|
||
## Create a commit | ||
|
||
Commit messages should be well formatted. | ||
Start your commit message with the type. Choose one of the following: | ||
`feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `revert`, `add`, `remove`, `move`, `bump`, `update`, `release` | ||
|
||
After a colon, you should give the message a title, starting with uppercase and ending without a dot. | ||
Keep the width of the text at 72 chars. | ||
The title must be followed with a newline, then a more detailed description. | ||
|
||
Please reference any GitHub issues on the last line of the commit message (e.g. `See #123`, `Closes #123`, `Fixes #123`). | ||
|
||
An example: | ||
|
||
``` | ||
docs: Add example for --release-notes flag | ||
I added an example to the docs of the `--release-notes` flag to make | ||
the usage more clear. The example is an realistic use case and might | ||
help others to generate their own changelog. | ||
See #284 | ||
``` | ||
|
||
## Submit a pull request | ||
|
||
Push your branch to your `cachego` fork and open a pull request against the | ||
master branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,49 @@ | ||
.PHONY: clean configure test test-coverage | ||
|
||
.DEFAULT_GOAL := test | ||
|
||
# Clean up | ||
clean: | ||
@rm -fR vendor/ cover.* | ||
@docker-compose stop | ||
@docker-compose rm -f | ||
rm -fR ./vendor/ ./cover.* | ||
.PHONY: clean | ||
|
||
# Download dependencies | ||
configure: | ||
@dep ensure -v | ||
@docker-compose up -d | ||
dep ensure -v | ||
.PHONY: configure | ||
|
||
test: | ||
@go test -v . | ||
# Run tests and generates html coverage file | ||
cover: test | ||
go tool cover -html=./cover.out -o ./cover.html | ||
.PHONY: cover | ||
|
||
# Download dependencies | ||
depend: | ||
go get -u gopkg.in/alecthomas/gometalinter.v2 | ||
gometalinter.v2 --install | ||
go get -u github.com/golang/dep/... | ||
.PHONY: depend | ||
|
||
# Up the docker container for testing | ||
docker: | ||
docker-compose up -d | ||
.PHONY: docker | ||
|
||
test-coverage: | ||
@go test -coverprofile=cover.out -v . | ||
@go tool cover -html=cover.out -o cover.html | ||
# Format all go files | ||
fmt: | ||
gofmt -s -w -l $(shell go list -f {{.Dir}} ./... | grep -v /vendor/) | ||
.PHONY: fmt | ||
|
||
# Run linters | ||
lint: | ||
gometalinter.v2 \ | ||
--vendor \ | ||
--disable-all \ | ||
--enable=golint \ | ||
--enable=gofmt \ | ||
--enable=misspell \ | ||
--enable=vet ./... | ||
.PHONY: lint | ||
|
||
# Run tests | ||
test: | ||
go test -v -race -coverprofile=./cover.out $(shell go list ./... | grep -v /vendor/) | ||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters