Skip to content

Commit

Permalink
feat: integrate packing function into Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
moooofly committed Jun 27, 2018
1 parent c2132d8 commit c0568b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 26 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ ifeq "$(GOPATH)" ""
$(error Please set the environment variable GOPATH before running `make`)
endif


GO := go
GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG)


LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.ClientVersion=$(shell cat VERSION)"
LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.GoVersion=$(shell go version)"
LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.UTCBuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S')"
Expand All @@ -20,24 +18,35 @@ LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.GitHash=$(shell git re
all: lint build test

build:
@echo "==> Building ..."
$(GOBUILD) -ldflags '$(LDFLAGS)' ./

install:
@echo "==> Installing ..."
$(GO) install -x ${SRC}

lint:
gometalinter --exclude=vendor --disable-all --enable=golint --enable=vet --enable=gofmt --enable=misspell ./...
find . -name '*.go' -not -path "./vendor/*" | xargs gofmt -w -s

test:
@echo "==> Testing ..."
$(GO) test ${SRC}

pack: build
@echo "==> Packing ..."
@tar czvf $(shell cat VERSION)-bin.tar.gz harbor-go-client conf/*.yaml
@echo ""
@rm harbor-go-client

misspell:
# misspell - requires that the following be run first:
# go get -u github.com/client9/misspell/cmd/misspell
find . -name '*.go' -not -path './vendor/*' -not -path './_repos/*' | xargs misspell -error

clean:
@echo "==> Cleaning ..."
$(GO) clean -x -i ${SRC}
rm -rf *.out
rm -rf *.tar.gz

24 changes: 0 additions & 24 deletions scripts/binPack.sh

This file was deleted.

0 comments on commit c0568b6

Please sign in to comment.