aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Abhinav Gupta <mail@abhinavg.net> 2019-01-02 16:36:04 -0800
committerGravatar GitHub <noreply@github.com> 2019-01-02 16:36:04 -0800
commitfa1cf198a7c22a0f7537c565e36a19567bbde0d8 (patch)
tree05784d90af9d96ebdab015e08372c76a3cf1aac1 /Makefile
parent4f14effe2d5e01058696fc1038255d0b2dd54179 (diff)
downloadsally-fa1cf198a7c22a0f7537c565e36a19567bbde0d8.tar.gz
sally-fa1cf198a7c22a0f7537c565e36a19567bbde0d8.tar.zst
sally-fa1cf198a7c22a0f7537c565e36a19567bbde0d8.zip
Upgrade to Go 1.11 and use modules (#33)
This commit modernizes the repository organization a bit. In short, this, - Upgrades to Go 1.11. - Uses Go modules instead of Glide. - Drops errcheck, which we rarely use in our codebase internally. - Uses `./...` to run build, tests, etc. since that does not have to account for vendor anymore. - Drops `-installsuffix cgo` from the production build. This was a workaround for pre-1.10 versions of Go. See https://github.com/golang/go/issues/9344#issuecomment-69944514. - Uses a tools.go as recommended in [go-modules-by-example/tools][1] to pin to tool dependencies. - Uses `go run` instead of `go install`ing tools globally. [1]: https://github.com/go-modules-by-example/index/tree/master/010_tools Tested locally with `make docker-launch`.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 10 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 43bae42..7c25a34 100644
--- a/Makefile
+++ b/Makefile
@@ -1,61 +1,38 @@
-PKGS := $(shell go list ./... | grep -v go.uber.org/sally/vendor)
-SRCS := $(wildcard *.go)
+GOLINT = go run github.com/golang/lint/golint
+STATICCHECK = go run honnef.co/go/tools/cmd/staticcheck
.PHONY: all
all: test
-.PHONY: vendor-update
-vendor-update:
- go get -v github.com/Masterminds/glide
- glide update
-
-.PHONY: vendor-install
-vendor-install:
- go get -v github.com/Masterminds/glide
- glide install
-
.PHONY: build
build:
- go build $(PKGS)
+ go build
.PHONY: install
install:
- go install $(PKGS)
+ go install .
.PHONY: lint
lint:
- go install ./vendor/github.com/golang/lint/golint
- for file in $(SRCS); do \
- golint $$file; \
- if [ -n "$$(golint $$file)" ]; then \
- exit 1; \
- fi; \
- done
+ $(GOLINT) ./...
.PHONY: vet
vet:
- go vet $(PKGS)
-
-.PHONY: errcheck
-errcheck:
- go install ./vendor/github.com/kisielk/errcheck
- errcheck $(PKGS)
+ go vet ./...
.PHONY: staticcheck
staticcheck:
- go install ./vendor/honnef.co/go/tools/cmd/staticcheck
- staticcheck $(PKGS)
+ $(STATICCHECK) -tests=false ./...
.PHONY: pretest
-pretest: lint vet errcheck staticcheck
+pretest: lint vet staticcheck
.PHONY: test
test: pretest
- go test -race $(PKGS)
+ go test -race ./...
.PHONY: clean
clean:
- go clean -i $(PKGS)
rm -rf _tmp
.PHONY: docker-build-dev
@@ -70,7 +47,7 @@ docker-test: docker-build-dev
docker-build-internal:
rm -rf _tmp
mkdir -p _tmp
- CGO_ENABLED=0 go build -a -installsuffix cgo -o _tmp/sally $(SRCS)
+ CGO_ENABLED=0 go build -a -o _tmp/sally .
docker build -t uber/sally -f Dockerfile.scratch .
.PHONY: docker-build