-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from JaSei/implementation
initial implementation
- Loading branch information
Showing
48 changed files
with
2,126 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ _testmain.go | |
*.exe | ||
*.test | ||
*.prof | ||
|
||
coverage.txt |
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,37 @@ | ||
# {{ .Name }} | ||
|
||
[![Release](https://img.shields.io/github/release/JaSei/pathutil-go.svg?style=flat-square)](https://github.com/JaSei/pathutil-go/releases/latest) | ||
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) | ||
[![Travis](https://img.shields.io/travis/JaSei/pathutil-go.svg?style=flat-square)](https://travis-ci.org/JaSei/pathutil-go) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/JaSei/pathutil-go?style=flat-square)](https://goreportcard.com/report/github.com/JaSei/pathutil-go) | ||
[![GoDoc](https://godoc.org/github.com/JaSei/pathutil-go?status.svg&style=flat-square)](http://godoc.org/github.com/JaSei/pathutil-go) | ||
[![codecov.io](https://codecov.io/github/JaSei/pathutil-go/coverage.svg?branch=master)](https://codecov.io/github/JaSei/pathutil-go?branch=master) | ||
[![Sourcegraph](https://sourcegraph.com/github.com/JaSei/pathutil-go/-/badge.svg)](https://sourcegraph.com/github.com/JaSei/pathutil-go?badge) | ||
|
||
{{ .EmitSynopsis }} | ||
|
||
{{ .EmitUsage }} | ||
|
||
|
||
## Contributing | ||
|
||
Contributions are very much welcome. | ||
|
||
### Makefile | ||
|
||
Makefile provides several handy rules, like README.md `generator` , `setup` for prepare build/dev environment, `test`, `cover`, etc... | ||
|
||
Try `make help` for more information. | ||
|
||
### Before pull request | ||
|
||
please try: | ||
* run tests (`make test`) | ||
* run linter (`make lint`) | ||
* if your IDE don't automaticaly do `go fmt`, run `go fmt` (`make fmt`) | ||
|
||
### README | ||
|
||
README.md are generate from template [.godocdown.tmpl](.godocdown.tmpl) and code documentation via [godocdown](https://github.com/robertkrimen/godocdown). | ||
|
||
Never edit README.md direct, because your change will be lost. |
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,20 @@ | ||
language: go | ||
|
||
os: | ||
- linux | ||
|
||
go: | ||
- 1.5 | ||
- 1.6 | ||
- 1.7 | ||
- 1.8 | ||
- 1.9 | ||
|
||
install: | ||
- make setup | ||
|
||
script: | ||
- make ci | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,7 @@ | ||
[[constraint]] | ||
name = "github.com/pkg/errors" | ||
version = "0.8.0" | ||
|
||
[[constraint]] | ||
name = "github.com/stretchr/testify" | ||
version = "1.1.4" |
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,78 @@ | ||
HELP?=$$(go run main.go --help 2>&1) | ||
VERSION?=$$(cat VERSION) | ||
GO18?=$(shell go version | grep -E "go1\.[89]") | ||
DEP?=$$(which dep) | ||
export GO15VENDOREXPERIMENT=1 | ||
|
||
ifeq ($(OS),Windows_NT) | ||
DEP_VERS=dep-windows-amd64.exe | ||
else ifeq ($(OS), Darwin) | ||
DEP_VERS=dep-darwin-amd64 | ||
else | ||
DEP_VERS=dep-linux-amd64 | ||
endif | ||
|
||
setup: ## Install all the build and lint dependencies | ||
go get -u golang.org/x/tools/cmd/cover | ||
go get -u github.com/robertkrimen/godocdown/godocdown | ||
@if [ "$(DEP)" = "" ]; then\ | ||
curl -L https://github.com/golang/dep/releases/download/v0.4.1/$(DEP_VERS) >| $$GOPATH/bin/dep;\ | ||
chmod +x $$GOPATH/bin/dep;\ | ||
fi | ||
dep ensure | ||
ifeq ($(GO18),) | ||
@echo no install metalinter, because metalinter need go1.8+ | ||
else | ||
go get -u github.com/alecthomas/gometalinter | ||
gometalinter --install | ||
endif | ||
|
||
generate: ## Generate README.md | ||
godocdown >| README.md | ||
|
||
test: generate ## Run all the tests | ||
echo 'mode: atomic' > coverage.txt && go list ./... | grep -v vendor | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.txt' && rm coverage.tmp | ||
|
||
cover: test ## Run all the tests and opens the coverage report | ||
go tool cover -html=coverage.txt | ||
|
||
fmt: ## gofmt and goimports all go files | ||
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done | ||
|
||
lint: ## Run all the linters | ||
ifeq ($(GO18),) | ||
@echo no run metalinter, because metalinter need go1.8+ | ||
else | ||
#https://github.com/golang/go/issues/19490 | ||
#--enable=vetshadow \ | ||
gometalinter --vendor --disable-all \ | ||
--enable=deadcode \ | ||
--enable=ineffassign \ | ||
--enable=gosimple \ | ||
--enable=staticcheck \ | ||
--enable=gofmt \ | ||
--enable=goimports \ | ||
--enable=dupl \ | ||
--enable=misspell \ | ||
--enable=errcheck \ | ||
--enable=vet \ | ||
--deadline=10m \ | ||
--enable=vetshadow \ | ||
./... | ||
|
||
endif | ||
|
||
ci: test lint ## Run all the tests and code checks | ||
|
||
build: ## Build the app | ||
go build | ||
|
||
release: ## Release new version | ||
git tag | grep -q $(VERSION) && echo This version was released! Increase VERSION! || git tag $(VERSION) && git push origin $(VERSION) | ||
|
||
# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.DEFAULT_GOAL := build |
Oops, something went wrong.