Skip to content

Commit e05f483

Browse files
committed
use golang dep to manage dependencies
1 parent f2fe6eb commit e05f483

7 files changed

Lines changed: 286 additions & 10 deletions

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Dockerfile*
33
cloudcli
44
cloudcli-*
55
.*
6+
vendor

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
cloudcli
22
cloudcli-*
33
.idea
4+
python
5+
vendor
6+
cloudcli.exe

Dockerfile.build

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ ARG GOARCH
55
ENV GOOS ${GOOS}
66
ENV GOARCH ${GOARCH}
77

8-
RUN go get -v github.com/spf13/cobra/cobra
9-
RUN go get -v github.com/go-resty/resty
10-
RUN go get -v gopkg.in/yaml.v2
11-
RUN go get -v github.com/cpuguy83/go-md2man/md2man
12-
RUN go get -v golang.org/x/crypto/ssh
8+
RUN curl -f https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
139

1410
RUN mkdir -p /go/src/github.com/cloudwm/cli
1511
WORKDIR /go/src/github.com/cloudwm/cli

Gopkg.lock

Lines changed: 237 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
required = ["github.com/russross/blackfriday"]
2+
3+
[[constraint]]
4+
name = "github.com/go-resty/resty"
5+
version = "1.12.0"
6+
7+
[[constraint]]
8+
name = "github.com/mitchellh/go-homedir"
9+
version = "1.1.0"
10+
11+
[[constraint]]
12+
name = "github.com/spf13/cobra"
13+
version = "0.0.5"
14+
15+
[[constraint]]
16+
name = "github.com/spf13/viper"
17+
version = "1.4.0"
18+
19+
[[constraint]]
20+
branch = "master"
21+
name = "golang.org/x/crypto"
22+
23+
[[constraint]]
24+
name = "gopkg.in/yaml.v2"
25+
version = "2.2.2"
26+
27+
[[constraint]]
28+
branch = "master"
29+
name = "github.com/russross/blackfriday"
30+
31+
[prune]
32+
go-tests = true
33+
unused-packages = true

bin/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ start_build_environment() {
1717
-f "${CLOUDCLI_PROJECT_PATH}/Dockerfile.build" "${CLOUDCLI_PROJECT_PATH}" &&\
1818
docker run -d --rm --name "${BUILD_CONTAINER_NAME}" -v "${CLOUDCLI_PROJECT_PATH}:/go/src/github.com/cloudwm/cli" \
1919
-v "${CLOUDCLI_ETC_PATH}:${CLOUDCLI_ETC_PATH}" --network host \
20-
"${BUILD_CONTAINER_NAME}" tail -f /dev/null
20+
"${BUILD_CONTAINER_NAME}" tail -f /dev/null &&\
21+
docker exec -it "${BUILD_CONTAINER_NAME}" dep ensure
2122
}
2223

2324
run() {

bin/functions.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ make_build_environment() {
1414
local go_arch="${2}"
1515
local docker_image="${3}"
1616
if docker pull "${docker_image}"; then
17-
docker build --cache-from "${docker_image}" --build-arg GOOS="${go_os}" --build-arg GOARCH="${go_arch}" \
18-
-t "${docker_image}" -f ./Dockerfile.build .
17+
docker build --build-arg GOOS="${go_os}" --build-arg GOARCH="${go_arch}" \
18+
-t "${docker_image}" -f ./Dockerfile.build \
19+
--cache-from "${docker_image}" \
20+
.
1921
else
20-
docker build -t "${docker_image}" -f ./Dockerfile.build .
22+
docker build --build-arg GOOS="${go_os}" --build-arg GOARCH="${go_arch}" \
23+
-t "${docker_image}" -f ./Dockerfile.build \
24+
.
2125
fi &&\
22-
docker push "${docker_image}"
26+
docker push "${docker_image}" &&\
27+
docker run --rm -v "`pwd`:/go/src/github.com/cloudwm/cli" "${docker_image}" dep ensure
2328
}
2429

2530
get_binary_ext() {

0 commit comments

Comments
 (0)