Skip to content

Commit

Permalink
Makefile: Ensure GO111MODULE=on is set
Browse files Browse the repository at this point in the history
  • Loading branch information
rvolosatovs committed Feb 18, 2019
1 parent 9213eac commit e046baa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
PKG := $(shell go list .)
PKGS := $(shell go list ./...)

GO111MODULE=on

.PHONY: bootstrap
bootstrap: testdata # set up the project for development

Expand All @@ -11,20 +13,20 @@ lint: # lints the package for common code smells
out=`gofmt -s -d $$f`; \
test -z "$$out" || (echo $$out && exit 1); \
done
GO111MODULE=on go run golang.org/x/lint/golint -set_exit_status $(PKGS)
go run golang.org/x/lint/golint -set_exit_status $(PKGS)
go vet -all -shadow -shadowstrict $(PKGS)

.PHONY: quick
quick: testdata # runs all tests without the race detector or coverage
GO111MODULE=on go test $(PKGS)
go test $(PKGS)

.PHONY: tests
tests: testdata # runs all tests against the package with race detection and coverage percentage
GO111MODULE=on go test -race -cover $(PKGS)
go test -race -cover $(PKGS)

.PHONY: cover
cover: testdata # runs all tests against the package, generating a coverage report and opening it in the browser
GO111MODULE=on go test -race -covermode=atomic -coverprofile=cover.out $(PKGS) || true
go test -race -covermode=atomic -coverprofile=cover.out $(PKGS) || true
go tool cover -html cover.out -o cover.html
open cover.html

Expand Down Expand Up @@ -78,13 +80,13 @@ testdata-go: bin/protoc-gen-go bin/protoc-gen-debug # generate go-specific testd
testdata-outputs

bin/protoc-gen-go: # creates the protoc-gen-go plugin using the vendored version
GO111MODULE=on go build -o $@ github.com/golang/protobuf/protoc-gen-go
go build -o $@ github.com/golang/protobuf/protoc-gen-go

bin/protoc-gen-example: # creates the demo protoc plugin for demonstrating uses of PG*
GO111MODULE=on go build -o $@ ./testdata/protoc-gen-example
go build -o $@ ./testdata/protoc-gen-example

bin/protoc-gen-debug: # creates the protoc-gen-debug protoc plugin for output ProtoGeneratorRequest messages
GO111MODULE=on go build -o $@ ./protoc-gen-debug
go build -o $@ ./protoc-gen-debug

.PHONY: clean
clean:
Expand Down

0 comments on commit e046baa

Please sign in to comment.