Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_output/
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: go
go:
- "1.11.x"
- "1.15.x"

before_install:
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- dep ensure
228 changes: 0 additions & 228 deletions Gopkg.lock

This file was deleted.

15 changes: 0 additions & 15 deletions Gopkg.toml

This file was deleted.

40 changes: 23 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,26 @@
BIN ?= docker-socket-firewall
PKG := github.com/linead/docker-socket-firewall

TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1)
TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
COMMIT := $(shell git rev-parse --short HEAD)
DATE := $(shell git log -1 --format=%cd --date=format:"%Y%m%d")
VERSION := $(TAG:v%=%)
ifneq ($(COMMIT), $(TAG_COMMIT))
VERSION := $(VERSION)-next-$(COMMIT)-$(DATE)
endif
ifeq ($(VERSION,), "" )
VERSION := $(COMMIT)-$(DATA)
endif
ifneq ($(shell git status --porcelain),)
VERSION := $(VERSION)-dirty
endif

LDFLAGS := -ldflags "-X main.gitInfo=$(VERSION)"

local : ARCH ?= $(shell go env GOOS)-$(shell go env GOARCH)
ARCH ?= linux-amd64

SRC_DIRS := cmd pkg # directories which hold app source (not vendored)

CLI_PLATFORMS := linux-amd64 darwin-amd64

platform_temp = $(subst -, ,$(ARCH))
Expand All @@ -17,29 +32,20 @@ VERSION ?= master
local: build-dirs
GOOS=$(GOOS) \
GOARCH=$(GOARCH) \
VERSION=$(VERSION) \
PKG=$(PKG) \
BIN=$(BIN) \
OUTPUT_DIR=$$(pwd)/_output/bin/$(GOOS)/$(GOARCH) \
./hack/build.sh
go build $(LDFLAGS)
mv $(BIN) _output/bin/$(GOOS)/$(GOARCH)/

mac:
GOOS=darwin \
GOARCH=amd64 \
VERSION=$(VERSION) \
PKG=$(PKG) \
BIN=$(BIN) \
OUTPUT_DIR=$$(pwd)/_output/bin/linux/amd64 \
./hack/build.sh
go build $(LDFLAGS)
mv $(BIN) _output/bin/darwin/amd64/

linux:
GOOS=linux \
GOARCH=amd64 \
VERSION=$(VERSION) \
PKG=$(PKG) \
BIN=$(BIN) \
OUTPUT_DIR=$$(pwd)/_output/bin/linux/amd64 \
./hack/build.sh
go build $(LDFLAGS)
mv $(BIN) _output/bin/linux/amd64/

tests:
go test -covermode=count ./...
Expand Down
Loading