- makefile
# Go parameters
GOPATH=$(CURDIR)
GOCMD=go
VERSION=1.0
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=ccp
BINARY_UNIX=$(BINARY_NAME)_unix
MAIN=./src/xxx.com/collect/app.go
all: deps build
build:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v $(MAIN)
docker build -t data-service:$(VERSION) .
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
run:
$(GOBUILD) -o $(BINARY_NAME) -v $(MAIN)
./$(BINARY_NAME)
deps:
@cd src && glide install
-
工程目录
-
src 目录
glide 文件
package: .
import:
- package: github.com/gin-gonic/gin
- package: github.com/jinzhu/gorm
subpackages:
- dialects/postgres