@ -4,6 +4,8 @@ BINDATA := modules/{options,public,templates}/bindata.go
STYLESHEETS := $( wildcard public/less/index.less public/less/_*.less)
STYLESHEETS := $( wildcard public/less/index.less public/less/_*.less)
JAVASCRIPTS :=
JAVASCRIPTS :=
DOCKER_TAG := gitea/gitea:latest
DOCKER_TAG := gitea/gitea:latest
GOFILES := $( shell find . -name "*.go" -type f -not -path "./vendor/*" -not -path "*/bindata.go" )
GOFMT ?= gofmt -s
GOFLAGS := -i -v
GOFLAGS := -i -v
EXTRA_GOFLAGS ?=
EXTRA_GOFLAGS ?=
@ -12,7 +14,6 @@ LDFLAGS := -X "main.Version=$(shell git describe --tags --always | sed 's/-/+/'
PACKAGES ?= $( filter-out code.gitea.io/gitea/integrations,$( shell go list ./... | grep -v /vendor/) )
PACKAGES ?= $( filter-out code.gitea.io/gitea/integrations,$( shell go list ./... | grep -v /vendor/) )
SOURCES ?= $( shell find . -name "*.go" -type f)
SOURCES ?= $( shell find . -name "*.go" -type f)
GOFILES := $( shell find . -name "*.go" -type f -not -path "./vendor/*" )
TAGS ?=
TAGS ?=
@ -42,9 +43,12 @@ clean:
go clean -i ./...
go clean -i ./...
rm -rf $( EXECUTABLE) $( DIST) $( BINDATA)
rm -rf $( EXECUTABLE) $( DIST) $( BINDATA)
required-gofmt-version :
@go version | grep -q '\(1.7\|1.8\)' || { echo "We require go version 1.7 or 1.8 to format code" >& 2 && exit 1; }
.PHONY : fmt
.PHONY : fmt
fmt :
fmt : required -gofmt -version
find . -name "*.go" -type f -not -path "./vendor/*" | xargs gofmt -s -w
$( GOFMT) -w $( GOFILES)
.PHONY : vet
.PHONY : vet
vet :
vet :
@ -88,8 +92,18 @@ misspell:
fi
fi
misspell -w -i unknwon $( GOFILES)
misspell -w -i unknwon $( GOFILES)
.PHONY : fmt -check
fmt-check : required -gofmt -version
# get all go files and run go fmt on them
@diff= $$ ( $( GOFMT) -d $( GOFILES) ) ; \
if [ -n " $$ diff " ] ; then \
echo "Please run 'make fmt' and commit the result:" ; \
echo " $$ {diff} " ; \
exit 1; \
fi ;
.PHONY : test
.PHONY : test
test :
test : fmt -check
go test $( PACKAGES)
go test $( PACKAGES)
.PHONY : test -coverage
.PHONY : test -coverage