Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Go Httpbin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Nix
Go Httpbin
Commits
c810e63c
Commit
c810e63c
authored
6 years ago
by
Will McCutchen
Browse files
Options
Downloads
Patches
Plain Diff
Better Makefile
- automatic dependency installation - add linting - test w/ race detector by default
parent
dccb6b3d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Makefile
+39
-17
39 additions, 17 deletions
Makefile
with
39 additions
and
17 deletions
Makefile
+
39
−
17
View file @
c810e63c
commit
:=
$(
shell git rev-parse
--short
HEAD
)
.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
:
assets
cmd/go-httpbin/*.go httpbin/*.go
dist/go-httpbin
:
$(GENERATED_ASSETS_PATH)
cmd/go-httpbin/*.go httpbin/*.go
mkdir
-p
dist
go build
-o
dist/go-httpbin ./cmd/go-httpbin
assets
:
httpbin/assets/*
go-bindata
-o
httpbin/assets/assets.go
-pkg
=
assets
-prefix
=
static static
$(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
:
assets
go
test
./...
test
:
go
test
$(
TEST_ARGS
)
./...
testcover
:
assets
testcover
:
mkdir
-p
dist
go
test
-coverprofile
=
dist/coverage.out github.com/mccutchen/go-httpbin/httpbin
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
deps
:
go get
-u
github.com/kevinburke/go-bindata/...
image
:
assets cmd/go-httpbin/*.go httpbin/*.go
mkdir
-p
/tmp/go-httpbin-docker
cp
Dockerfile /tmp/go-httpbin-docker
GOOS
=
linux
GOARCH
=
amd64 go build
-o
/tmp/go-httpbin-docker/go-httpbin ./cmd/go-httpbin
docker build
-t
mccutchen/go-httpbin:
$(
commit
)
/tmp/go-httpbin-docker
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
)
docker push mccutchen/go-httpbin:
$(
COMMIT
)
assets
:
$(GENERATED_ASSETS_PATH)
deps
:
$(GOLINT) $(GOBINDATA)
$(GOLINT)
:
go get
-u
golang.org/x/lint/golint
$(GOBINDATA)
:
go get
-u
github.com/kevinburke/go-bindata/...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment