Skip to content
Snippets Groups Projects
Select Git revision
  • 74bb4fd9ff0982a395046f534f122f44fa9ae64a
  • master default protected
  • 0.5.9
  • 0.5.8
  • 0.5.7
  • 0.5.6
  • 0.5.5
  • 0.5.4
  • 0.5.3
  • 0.5.2
  • 0.5.1
  • 0.5.0
  • 0.4.17
  • 0.4.16
  • 0.4.15
  • 0.4.14
  • 0.4.13
  • 0.4.12
  • 0.4.11
  • 0.4.10
  • 0.4.9
  • 0.4.8
22 results

modules.txt

Blame
  • Makefile 1.50 KiB
    .PHONY: clean deps image imagepush run test testcover
    
    COMMIT := $(shell git rev-parse --short HEAD)
    GENERATED_ASSETS_PATH := httpbin/assets/assets.go
    BIN_DIR := $(GOPATH)/bin
    GOLINT := $(BIN_DIR)/golint
    GOBINDATA := $(BIN_DIR)/go-bindata
    TEST_ARGS := -race
    
    build: dist/go-httpbin
    
    dist/go-httpbin: $(GENERATED_ASSETS_PATH) cmd/go-httpbin/*.go httpbin/*.go go.mod
    	mkdir -p dist
    	go build -o dist/go-httpbin ./cmd/go-httpbin
    
    $(GENERATED_ASSETS_PATH): $(GOBINDATA) static/*
    	$(GOBINDATA) -o $(GENERATED_ASSETS_PATH) -pkg=assets -prefix=static static
    	# reformat generated code
    	gofmt -s -w $(GENERATED_ASSETS_PATH)
    	# dumb hack to make generate code lint correctly
    	sed -i.bak 's/Html/HTML/g' $(GENERATED_ASSETS_PATH)
    	sed -i.bak 's/Xml/XML/g' $(GENERATED_ASSETS_PATH)
    	rm $(GENERATED_ASSETS_PATH).bak
    
    test:
    	go test $(TEST_ARGS) ./...
    
    testcover:
    	mkdir -p dist
    	go test $(TEST_ARGS) -coverprofile=dist/coverage.out github.com/mccutchen/go-httpbin/httpbin
    	go tool cover -html=dist/coverage.out
    
    lint: $(GOLINT)
    	test -z "$$(gofmt -d -s -e .)" || (gofmt -d -s -e . ; exit 1)
    	$(GOLINT) -set_exit_status ./...
    	go vet ./...
    
    run: build
    	./dist/go-httpbin
    
    clean:
    	rm -r dist
    
    image: $(GENERATED_ASSETS_PATH) cmd/go-httpbin/*.go httpbin/*.go
    	docker build -t mccutchen/go-httpbin:$(COMMIT) .
    
    imagepush: image
    	docker push mccutchen/go-httpbin:$(COMMIT)
    
    assets: $(GENERATED_ASSETS_PATH)
    
    deps: $(GOLINT) $(GOBINDATA)
    
    $(GOLINT):
    	go get -u golang.org/x/lint/golint
    
    $(GOBINDATA):
    	cd /tmp && go get -u github.com/kevinburke/go-bindata/...