-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
47 lines (35 loc) · 1.38 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
TEST?=./...
SDK_BRANCH?=master
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
PKG_NAME=ovc
WEBSITE_REPO=github.com/hashicorp/terraform-website
default: build
build: fmtcheck
CGO_ENABLED=0 GO111MODULE=on go build -mod vendor ${BUILDARGS}
build-linux: fmtcheck
CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 go build -mod vendor ${BUILDARGS} .
build-darwin: fmtcheck
CGO_ENABLED=0 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -mod vendor ${BUILDARGS} .
install: fmtcheck
GO111MODULE=on go install -mod vendor
test: lint
go test $(TEST) -timeout=30s -parallel=4
fmtcheck:
@echo "==> Checking that code complies with gofmt requirements...."
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -s -w ./$(PKG_NAME)
tools:
GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
lint: fmtcheck
@echo "==> Checking source code against linters..."
@# errcheck dissabled as it errors on not handling d.Set which would be combursome for the likeiness of occurance
@# inproper err handling will still be caught by ineffassign and other linters
@golangci-lint run ./$(PKG_NAME) -D errcheck
@go vet ./$(PKG_NAME)
update_sdk:
GO111MODULE=on go get -u github.com/gig-tech/ovc-sdk-go@$(SDK_BRANCH)
GO111MODULE=on go mod vendor
GO111MODULE=on go mod tidy
.PHONY: default build install test fmt fmtcheck lint tools