Skip to content

Commit

Permalink
feat: add fmt check command. (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy authored Mar 31, 2017
1 parent b5e1a03 commit cdf2348
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
24 changes: 20 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,31 @@ embedmd:
fi
embedmd -d *.md

test:
fmt:
find . -name "*.go" -type f -not -path "./vendor/*" | xargs gofmt -s -w

.PHONY: fmt-check
fmt-check:
@if git diff --quiet --exit-code; then \
$(MAKE) fmt && git diff --exit-code || { \
git checkout .; \
echo; \
echo "Please run 'make fmt' and commit the result"; \
echo; \
false; } >&2; \
else { \
echo; \
echo "'make fmt-check' cannot be run with unstaged changes"; \
echo; \
false; } >&2; \
fi

test: fmt-check
for PKG in $(PACKAGES); do go test -v -cover -coverprofile $$GOPATH/src/$$PKG/coverage.txt $$PKG || exit 1; done;

html:
go tool cover -html=.cover/coverage.txt

fmt:
find . -name "*.go" -type f -not -path "./vendor/*" | xargs gofmt -s -w

vet:
go vet $(PACKAGES)

Expand Down
6 changes: 3 additions & 3 deletions auth_jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ func (mw *GinJWTMiddleware) MiddlewareInit() error {
}

if mw.IdentityHandler == nil {
mw.IdentityHandler = func (claims jwt.MapClaims) string {
return claims["id"].(string)
}
mw.IdentityHandler = func(claims jwt.MapClaims) string {
return claims["id"].(string)
}
}

if mw.Realm == "" {
Expand Down

0 comments on commit cdf2348

Please sign in to comment.