mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 09:16:29 +00:00
Makefile: Update for ease of Homebrew installation
This removes the `lint` dependency from building Moby. I've also added ineffassign to check ineffecutal assignments alongside checks to ensure that both it and golint are installed. Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
This commit is contained in:
parent
4db06aa173
commit
5934a24206
22
Makefile
22
Makefile
@ -6,23 +6,35 @@ default: moby
|
|||||||
DEPS=$(wildcard cmd/moby/*.go) Makefile
|
DEPS=$(wildcard cmd/moby/*.go) Makefile
|
||||||
PREFIX?=/usr/local
|
PREFIX?=/usr/local
|
||||||
|
|
||||||
moby: $(DEPS) lint
|
GOLINT:=$(shell command -v golint 2> /dev/null)
|
||||||
|
INEFFASSIGN:=$(shell command -v ineffassign 2> /dev/null)
|
||||||
|
|
||||||
|
moby: $(DEPS)
|
||||||
go build --ldflags "-X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)" -o $@ github.com/moby/tool/cmd/moby
|
go build --ldflags "-X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)" -o $@ github.com/moby/tool/cmd/moby
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY:
|
||||||
lint:
|
lint:
|
||||||
|
ifndef GOLINT
|
||||||
|
$(error "Please install golint! go get -u github.com/tool/lint")
|
||||||
|
endif
|
||||||
|
ifndef INEFFASSIGN
|
||||||
|
$(error "Please install ineffassign! go get -u github.com/gordonklaus/ineffassign")
|
||||||
|
endif
|
||||||
# golint
|
# golint
|
||||||
@test -z "$(shell find . -type f -name "*.go" -not -path "./vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)"
|
@test -z "$(shell find . -type f -name "*.go" -not -path "./vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)"
|
||||||
# gofmt
|
# gofmt
|
||||||
@test -z "$$(gofmt -s -l .| grep -v .pb. | grep -v vendor/ | tee /dev/stderr)"
|
@test -z "$$(gofmt -s -l .| grep -v .pb. | grep -v vendor/ | tee /dev/stderr)"
|
||||||
|
# ineffassign
|
||||||
|
@test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec ineffassign {} \; | tee /dev/stderr)
|
||||||
ifeq ($(GOOS),)
|
ifeq ($(GOOS),)
|
||||||
# govet
|
# govet
|
||||||
@test -z "$$(go tool vet -printf=false . 2>&1 | grep -v vendor/ | tee /dev/stderr)"
|
@test -z "$$(go tool vet -printf=false . 2>&1 | grep -v vendor/ | tee /dev/stderr)"
|
||||||
# go test
|
|
||||||
@go test github.com/moby/tool/src/moby
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test: moby
|
test: lint moby
|
||||||
|
# go test
|
||||||
|
@go test github.com/moby/tool/src/moby
|
||||||
|
# test build
|
||||||
./moby build -output tar test/test.yml
|
./moby build -output tar test/test.yml
|
||||||
rm moby test.tar
|
rm moby test.tar
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: go get github.com/golang/lint/golint
|
- run: go get github.com/golang/lint/golint
|
||||||
|
- run: go get github.com/gordonklaus/ineffassign
|
||||||
- run: cd $GOPATH/src/github.com/moby/tool && make test
|
- run: cd $GOPATH/src/github.com/moby/tool && make test
|
||||||
- run: cd $GOPATH/src/github.com/moby/tool && make clean && make GOOS=darwin
|
- run: cd $GOPATH/src/github.com/moby/tool && make clean && make GOOS=darwin lint moby
|
||||||
- run: cd $GOPATH/src/github.com/moby/tool && make clean && make GOOS=windows
|
- run: cd $GOPATH/src/github.com/moby/tool && make clean && make GOOS=windows lint moby
|
||||||
|
Loading…
Reference in New Issue
Block a user