add golint and go vet to test target

This commit adds a target called setup-gotools which will download and
install golint and go vet. A developer who wants to run tests for an
individual component (manager, resourcifier, expandybird) can run `make
test` to run golint, vet, and test and in that directory. On first run,
a developer will want to run `make setup-gotools` so that they have
golint and vet to use locally.

There is a `make test` command in each component because running tests
from the root directory will result in lots of output. Running tests in
individual components will help isolate the tests for the component that
is being modified and result in more clear output.
pull/207/head
Michelle Noorali 9 years ago
parent 43d838f280
commit 14d75f4d21

@ -63,3 +63,7 @@ lint:
.PHONY: vet
vet:
$(GO_VET)
.PHONY: setup-gotools
setup-gotools:
$(SETUP_GOTOOLS)

@ -1,2 +1,4 @@
GO_VET := echo using go vet
GO_TEST := go test -v ./...
SETUP_GOTOOLS := @echo "Installing golint and vet" && go get -u github.com/golang/lint/golint && go get -u -v golang.org/x/tools/cmd/vet
GO_VET := @echo "Running go vet ..." && go vet ./...
GO_LINT := @echo "Running golint ..." && golint ./...
GO_TEST := @echo "Running tests ..." && go test -v ./...

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
include ../include.mk
.PHONY : all build test push container clean .project
DOCKER_REGISTRY := gcr.io
@ -41,5 +43,21 @@ container:
clean:
-docker rmi $(PREFIX)/$(IMAGE):$(TAG)
test:
go test -v ./...
.PHONY: test
test: lint vet test-unit
.PHONY: test-unit
test-unit:
$(GO_TEST)
.PHONY: lint
lint:
$(GO_LINT)
.PHONY: vet
vet:
$(GO_VET)
.PHONY: setup-gotools
setup-gotools:
$(SETUP_GOTOOLS)

@ -14,6 +14,8 @@
# If you update this image please check the tag value before pushing.
include ../include.mk
.PHONY : all build test push container clean
DOCKER_REGISTRY := gcr.io
@ -43,5 +45,21 @@ container:
clean:
-docker rmi $(PREFIX)/$(IMAGE):$(TAG)
test:
go test -v ./...
.PHONY: test
test: lint vet test-unit
.PHONY: test-unit
test-unit:
$(GO_TEST)
.PHONY: lint
lint:
$(GO_LINT)
.PHONY: vet
vet:
$(GO_VET)
.PHONY: setup-gotools
setup-gotools:
$(SETUP_GOTOOLS)

Loading…
Cancel
Save