Skip to content

Commit 0b86923

Browse files
author
Jean-Marcel Belmont
committed
Add makefile and include changes for using dep golang dependency manager.
1 parent 77d9e34 commit 0b86923

File tree

8 files changed

+168
-18
lines changed

8 files changed

+168
-18
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ key.pem
4242

4343
# Mongo data
4444
/mongo_data
45+
46+
# Go dependencies
47+
/vendor

.travis.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ sudo: required
33
language: go
44
go:
55
- 1.8.x
6+
67
before_install:
7-
- go get github.com/mattn/goveralls
8-
- go get github.com/stretchr/testify/assert
9-
- go get github.com/gorilla/mux
10-
- go get github.com/jbelmont/docker-workshop/handlers
11-
- go get github.com/jbelmont/docker-workshop/model
12-
- go get github.com/jbelmont/docker-workshop/redis
13-
- go get github.com/jbelmont/docker-workshop/routes
8+
- make travis-before-build-step
9+
10+
install:
11+
- make travis-build-step
12+
1413
before_script:
1514
- git config --global user.email "[email protected]"
1615
- git config --global user.name "jbelmont"
16+
1717
script:
18-
- go test ./...
18+
- make travis-script-step
19+
1920
env:
2021
global:
2122
secure: XR1gtkk5R+7UbgMs6pUxUkB4+RP67SR/3Q63CDf6wTv8gyxccTZ5ESXF6ii8k7iMPu8sPolN6EXTdVRV3kHN02CDr1kso00crPpn9eYFSUwEsTO5deh2/PK+po7rOKo+5QTjG1KPgeaQbkW/pdvE66PtHxH94WJ/6Ed2/yU2Atd3iKx8UInxgmOFpW1HeyrC55XBbxTcyQv+hMPqNKcrxZWJW4UU/qU88Pw5q9wEw0X8zrAF6O1asErgadsmhzBoD6dmlbNf1KFIrqujiIP21NEt+5DhtM4MV3iyNm3c9z4YnKWRzV6padrrW8enHVoKzQcbR9uzgHxoaAlsM6faaMmvrrjTcohDQK8fPtHxFTdN4W8JASJViEr/PUjZJvvcVAfKgRMgJY8FXL5aX68Le5WBK4PtMTWl7+0RdKtI66syc69q7pGJ79tbQa4ufv/CgBiI2WZPNftU5e+lFqlVfq8G3FZHkh0QRBL+FEU09x3ZKePxBh4oGLi3CCLcYu+nMwIL1R4IibNzm6xnxuXl/HwcJ5VGDQ1PC67E36jFeE+QGxjbQL1sRMaw+QgIYqijKapLz5/R7FvR0FG32v182XqV0dK/Wtze3/FxAsmi0n28FcdB9QqoEpOWNPCHaPeSPu49vVUIVzuZUP9G8Infjh3KrW1mRmcIKecHmDLOde0=

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ COPY package.json ${appDir}/package.json
1616

1717
# Install npm dependencies and install ava globally
1818
RUN npm install
19+
RUN npm install -g ava
1920
RUN npm rebuild node-sass
2021

2122
# Add main node execution command

Dockerfile-go

+3-9
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,14 @@ FROM golang:1.8.3
33
LABEL maintainer "[email protected]"
44

55
# Set Environment variables
6-
ENV appDir /var/www/app
6+
ENV appDir /go/src/github.com/jbelmont/containerized-golang-and-vuejs
77

88
# Set the work directory
99
RUN mkdir -p ${appDir}
1010
WORKDIR ${appDir}
1111
ADD . ${appDir}
1212

13-
RUN go get gopkg.in/mgo.v2
14-
RUN go get github.com/garyburd/redigo/redis
15-
RUN go get github.com/gorilla/mux
16-
RUN go get github.com/gorilla/handlers
17-
RUN go get github.com/jbelmont/containerized-golang-and-vuejs/routes
18-
RUN go get github.com/jbelmont/containerized-golang-and-vuejs/handlers
19-
RUN go get github.com/jbelmont/containerized-golang-and-vuejs/model
20-
RUN go get github.com/jbelmont/containerized-golang-and-vuejs/redis
13+
RUN go get -u github.com/golang/dep/cmd/dep && \
14+
dep ensure
2115

2216
RUN go build

Gopkg.lock

+78
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Gopkg.toml example
2+
#
3+
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
4+
# for detailed Gopkg.toml documentation.
5+
#
6+
# required = ["github.com/user/thing/cmd/thing"]
7+
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
8+
#
9+
# [[constraint]]
10+
# name = "github.com/user/project"
11+
# version = "1.0.0"
12+
#
13+
# [[constraint]]
14+
# name = "github.com/user/project2"
15+
# branch = "dev"
16+
# source = "github.com/myfork/project2"
17+
#
18+
# [[override]]
19+
# name = "github.com/x/y"
20+
# version = "2.4.0"
21+
22+
23+
[[constraint]]
24+
name = "github.com/garyburd/redigo"
25+
version = "1.4.0"
26+
27+
[[constraint]]
28+
name = "github.com/gorilla/mux"
29+
version = "1.6.0"
30+
31+
[[constraint]]
32+
name = "github.com/stretchr/testify"
33+
version = "1.2.0"
34+
35+
[[constraint]]
36+
branch = "v2"
37+
name = "gopkg.in/mgo.v2"
38+
39+
[[constraint]]
40+
name = "github.com/mattn/goveralls"
41+
version = "0.0.1"

makefile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
BIN_DIR := "bin/trilug"
2+
3+
all: ensure package
4+
5+
.PHONY: generate-coverage
6+
7+
ensure:
8+
dep ensure
9+
10+
package: compile
11+
12+
compile: main.go
13+
CGO_ENABLED=0 go build -i -o ${BIN_DIR} main.go
14+
15+
test:
16+
go test ./... -v
17+
18+
travis-before-build: travis-before-build-step
19+
20+
travis-before-build-step:
21+
export PATH=$PATH:$HOME/gopath/bin
22+
go get -u golang.org/x/tools/cmd/cover
23+
go get -u github.com/golang/dep/cmd/dep
24+
25+
travis-build-step:
26+
dep ensure
27+
28+
travis-script-step:
29+
set -e
30+
bash ${GOMETA_LINTER}
31+
CGO_ENABLED=0 go build -i -o ${BIN_DIR} main.go
32+
go test -cover ./...

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build": "docker-compose build",
1313
"lint": "eslint --ext .js .",
1414
"lint:fix": "eslint --fix --ext .js .",
15-
"go": "go run main.go data.go",
15+
"go": "go run *.go",
1616
"browser": "node browser.js",
1717
"dev": "docker-compose up frontend backend db redis",
1818
"dev:server": "npm run go & npm run webpack",

0 commit comments

Comments
 (0)