Skip to content

Commit

Permalink
cleanup Makefile for go1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
magiconair committed Feb 17, 2018
1 parent 17da55b commit 224ab70
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ VERSION = $(shell git describe --abbrev=0 | cut -c 2-)

# GO runs the go binary with garbage collection disabled for faster builds.
# Do not specify a full path for go since travis will fail.
GO = GOGC=off go
GO = go

# GOFLAGS is the flags for the go compiler. Currently, only the version number is
# passed to the linker via the -ldflags.
Expand All @@ -31,27 +31,25 @@ GOVENDOR = $(shell which govendor)
VENDORFMT = $(shell which vendorfmt)

# all is the default target
all: build test
all: test

# help prints a help screen
help:
@echo "build - go build"
@echo "install - go install"
@echo "test - go test"
@echo "gofmt - go fmt"
@echo "vet - go vet"
@echo "linux - go build linux/amd64"
@echo "release - tag, build and publish release with goreleaser"
@echo "pkg - build, test and create pkg/fabio.tar.gz"
@echo "clean - remove temp files"

# build compiles fabio and the test dependencies
build: checkdeps vendorfmt gofmt
$(GO) build -i $(GOFLAGS)
$(GO) test -i ./...
$(GO) build

# test runs the tests
test: checkdeps vendorfmt vet gofmt
test: build
$(GO) test -v -test.timeout 15s `go list ./... | grep -v '/vendor/'`

# checkdeps ensures that all required dependencies are vendored in
Expand All @@ -70,16 +68,12 @@ gofmt:

# linux builds a linux binary
linux:
GOOS=linux GOARCH=amd64 $(GO) build -i -tags netgo $(GOFLAGS)
GOOS=linux GOARCH=amd64 $(GO) build -tags netgo $(GOFLAGS)

# install runs go install
install:
$(GO) install $(GOFLAGS)

# vet runs go vet
vet:
$(GO) vet ./...

# pkg builds a fabio.tar.gz package with only fabio in it
pkg: build test
rm -rf pkg
Expand Down Expand Up @@ -139,4 +133,4 @@ clean:
rm -rf pkg dist fabio
find . -name '*.test' -delete

.PHONY: build clean docker gofmt homebrew install linux pkg release test vendorfmt vet
.PHONY: all build checkdeps clean codeship gofmt gorelease help homebrew install linux pkg preflight release tag test vendorfmt

0 comments on commit 224ab70

Please sign in to comment.