Skip to content

Commit

Permalink
Merge pull request #699 from mesg-foundation/fix/update-to-golang-v1.…
Browse files Browse the repository at this point in the history
…11.4

Fix missing update to golang v1.11.4
  • Loading branch information
NicolasMahe authored Jan 15, 2019
2 parents 74269f2 + 94e5854 commit 5fc2cf0
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runOnMachine: &runOnMachine

runOnDocker: &runOnDocker
docker:
- image: circleci/golang:1.11
- image: circleci/golang:1.11.4

jobs:
"test":
Expand Down
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ mesg-dev
.git
**/*.test
**/debug
node_modules
**/node_modules
bin/cli
docs/
scripts/
docker-images/

# prevent go build cache to break inside Docker on changes to systemservices/sources.
systemservices/sources
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
FROM golang:1.10.3-stretch AS build
WORKDIR src/github.com/mesg-foundation/core
# base Go image version.
FROM golang:1.11.4-stretch AS build

WORKDIR /project

# install dependencies
COPY go.mod go.sum ./
RUN go mod download

COPY . .
ARG version
RUN go build -o mesg-core \
Expand All @@ -12,5 +19,5 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /go/src/github.com/mesg-foundation/core/mesg-core .
COPY --from=build /project/mesg-core .
CMD ["./mesg-core"]
23 changes: 12 additions & 11 deletions Dockerfile.tools
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# base Go image version.
ARG go=1.11.0-stretch
FROM golang:1.11.4-stretch

FROM golang:$go
WORKDIR /project

# install dependencies
COPY go.mod go.sum ./
RUN go mod download

VOLUME /project

# install some dependencies from apt-get.
RUN apt-get update -y && \
Expand All @@ -18,15 +24,10 @@ RUN wget -q https://github.com/protocolbuffers/protobuf/releases/download/v$prot
mv /tmp/protobuf/bin/protoc /usr/local/bin/protoc && \
rm -rf /tmp/*

# symlink project path to have a short version for cosmetics.
RUN ln -s /go/src/github.com/mesg-foundation/core /core
WORKDIR /core
VOLUME /core

# cache vendor for faster builds while using go run commands.
# also needed to install script's dependencies into /go/bin.
ADD vendor/ vendor
RUN go install -i ./vendor/...
RUN go install github.com/go-bindata/go-bindata/go-bindata
RUN go install github.com/golang/protobuf/protoc-gen-go
RUN go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
RUN go install github.com/vektra/mockery/.../

# verify that mesg-dev container is being used.
ENV MESG_DEV true
4 changes: 2 additions & 2 deletions dev-core
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

DIR=${GOPATH:-$HOME/go}
DIR=$(pwd)
MESG_LOG_LEVEL=${MESG_LOG_LEVEL:-debug}
VERSION=local
LDFLAGS="-X 'github.com/mesg-foundation/core/version.Version=$VERSION'"
Expand Down Expand Up @@ -38,7 +38,7 @@ fi
# create a symlink for system services.
rm -rf "$HOME/.mesg/systemservices"
mkdir -p "$HOME/.mesg/"
ln -s "$DIR/src/github.com/mesg-foundation/core/systemservices/sources" "$HOME/.mesg/systemservices"
ln -s "$DIR/systemservices/sources" "$HOME/.mesg/systemservices"

echo "build mesg/core image"
if [[ ! $BINCACHED ]] || [[ ! $DOCKERCACHED ]]; then
Expand Down
9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/cnf/structhash v0.0.0-20180104161610-62a607eb0224
github.com/containerd/continuity v0.0.0-20180712174259-0377f7d76720 // indirect
github.com/cpuguy83/go-md2man v1.0.8 // indirect
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/docker/distribution v0.0.0-20180720172123-0dae0957e5fe // indirect
github.com/docker/docker v0.0.0-20180803200506-eeea12db7a65
github.com/docker/go-connections v0.0.0-20180212134524-7beb39f0b969 // indirect
Expand Down Expand Up @@ -52,7 +51,6 @@ require (
github.com/opencontainers/runc v0.1.1 // indirect
github.com/pelletier/go-buffruneio v0.0.0-20180119162133-e2f66f8164ca // indirect
github.com/pkg/errors v0.8.0
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pseudomuto/protoc-gen-doc v1.1.0
github.com/pseudomuto/protokit v0.1.0 // indirect
github.com/russross/blackfriday v1.5.1 // indirect
Expand All @@ -62,11 +60,10 @@ require (
github.com/spf13/cobra v0.0.0-20171207074935-ccaecb155a21
github.com/spf13/pflag v0.0.0-20180601132542-3ebe029320b2
github.com/src-d/gcfg v1.3.0 // indirect
github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.2.2
github.com/stretchr/testify v1.3.0
github.com/stvp/assert v0.0.0-20170616060220-4bc16443988b // indirect
github.com/syndtr/goleveldb v0.0.0-20180708030551-c4c61651e9e3
github.com/vektra/mockery v0.0.0-20180815001236-ea265755d541
github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5
github.com/xanzy/ssh-agent v0.2.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
Expand All @@ -75,7 +72,7 @@ require (
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c // indirect
golang.org/x/tools v0.0.0-20181004163742-59602fdee893 // indirect
golang.org/x/tools v0.0.0-20190111214448-fc1d57b08d7b // indirect
google.golang.org/genproto v0.0.0-20180709204101-e92b11657268 // indirect
google.golang.org/grpc v0.0.0-20180710012024-c491b25057c8
gopkg.in/AlecAivazis/survey.v1 v1.6.1
Expand Down
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ github.com/cpuguy83/go-md2man v1.0.8 h1:DwoNytLphI8hzS2Af4D0dfaEaiSq2bN05mEm4R6v
github.com/cpuguy83/go-md2man v1.0.8/go.mod h1:N6JayAiVKtlHSnuTCeuLSQVs75hb8q+dYQLjr7cDsKY=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/distribution v0.0.0-20180720172123-0dae0957e5fe h1:ZRQNMB7Sw5jf9g/0imDbI+vTFNk4J7qBdtFI5/zf1kg=
github.com/docker/distribution v0.0.0-20180720172123-0dae0957e5fe/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v0.0.0-20180803200506-eeea12db7a65 h1:WeqSIzsb30/sarqEph9RS+6xw8rmRpCACwV8+cJ1Rkc=
Expand Down Expand Up @@ -128,16 +129,20 @@ github.com/spf13/pflag v0.0.0-20180601132542-3ebe029320b2 h1:OAuq3yHhRwcm/kwCSAq
github.com/spf13/pflag v0.0.0-20180601132542-3ebe029320b2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/src-d/gcfg v1.3.0 h1:2BEDr8r0I0b8h/fOqwtxCEiq2HJu8n2JGZJQFGXWLjg=
github.com/src-d/gcfg v1.3.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stvp/assert v0.0.0-20170616060220-4bc16443988b h1:GlTM/aMVIwU3luIuSN2SIVRuTqGPt1P97YxAi514ulw=
github.com/stvp/assert v0.0.0-20170616060220-4bc16443988b/go.mod h1:CC7OXV9IjEZRA+znA6/Kz5vbSwh69QioernOHeDCatU=
github.com/syndtr/goleveldb v0.0.0-20180708030551-c4c61651e9e3 h1:sAlSBRDl4psFR3ysKXRSE8ss6Mt90+ma1zRTroTNBJA=
github.com/syndtr/goleveldb v0.0.0-20180708030551-c4c61651e9e3/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/vektra/mockery v0.0.0-20180815001236-ea265755d541 h1:Ou5sd/oSrXE5QqNlp85E1d1GFDquJ4Vsmc3Hqpr4IF8=
github.com/vektra/mockery v0.0.0-20180815001236-ea265755d541/go.mod h1:3LHOhl7yhnq4Wov6IXX3laolKx4NiYRqPgER/wSC2TQ=
github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5 h1:Xim2mBRFdXzXmKRO8DJg/FJtn/8Fj9NOEpO6+WuMPmk=
github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5/go.mod h1:ppEjwdhyy7Y31EnHRDm1JkChoC7LXIJ7Ex0VYLWtZtQ=
github.com/xanzy/ssh-agent v0.2.0 h1:Adglfbi5p9Z0BmK2oKU9nTG+zKfniSfnaMYB+ULd+Ro=
github.com/xanzy/ssh-agent v0.2.0/go.mod h1:0NyE30eGUDliuLEHJgYte/zncp2zdTStcOnWhgSqHD8=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
Expand All @@ -161,6 +166,8 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuA
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20181004163742-59602fdee893 h1:rsE8bdRd+SQZ1eQSuWpO3bw7AmfVa+vsnxkZ9tcPzAA=
golang.org/x/tools v0.0.0-20181004163742-59602fdee893/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181112210238-4b1f3b6b1646/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190111214448-fc1d57b08d7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
google.golang.org/genproto v0.0.0-20180709204101-e92b11657268 h1:ZxmDkz4oA3H5lKSXr68Ziv+dzLc6g/eMFgC0dg8wNtU=
google.golang.org/genproto v0.0.0-20180709204101-e92b11657268/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/grpc v0.0.0-20180710012024-c491b25057c8 h1:GQEf7UzpWu5cs276baekFHmem4nWmuAZe6pIAjjR+xY=
Expand Down
2 changes: 1 addition & 1 deletion mesg-tools
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
docker build -t mesg/tools:local -f Dockerfile.tools .

# shortland of container run command.
run_in_container="docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -v `pwd`:/core mesg/tools:local"
run_in_container="docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -v `pwd`:/project mesg/tools:local"

# run any command under dev container.
$run_in_container $@
6 changes: 2 additions & 4 deletions scripts/build-mocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
# make sure script is running inside mesg/tools container.
source $(dirname $0)/require-mesg-tools.sh

# navigate to core repo.
cd $GOPATH/src/github.com/mesg-foundation/core

# generate mocks for container package.
mockery -name=Container -dir ./container -output ./container/mocks

# generate mocks for docker.CommonAPIClient that used by container package.
mockery -name CommonAPIClient -dir ./vendor/github.com/docker/docker/client -output ./utils/docker/mocks
# TODO: to fix
# mockery -name CommonAPIClient -dir ./vendor/github.com/docker/docker/client -output ./utils/docker/mocks

# generate mocks for database package.
mockery -name=ServiceDB -dir ./database -output ./database/mocks
Expand Down
12 changes: 4 additions & 8 deletions scripts/build-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
# make sure script is running inside mesg/tools container.
source $(dirname $0)/require-mesg-tools.sh

cd $GOPATH/src

PROJECT=github.com/mesg-foundation/core
PROJECT=/project
GRPC=$PROJECT/protobuf
CORE=$(pwd)/$PROJECT
API_DOCS="--doc_out=$CORE/docs/api/ --doc_opt=$CORE/docs/api.template"
GRPC_PLUGIN="--go_out=plugins=grpc:./"
API_DOCS="--doc_out=$PROJECT/docs/api/ --doc_opt=$PROJECT/docs/api.template"

protoc $GRPC_PLUGIN $API_DOCS,core.md --proto_path=./ $GRPC/coreapi/api.proto
protoc $GRPC_PLUGIN $API_DOCS,service.md --proto_path=./ $GRPC/serviceapi/api.proto
protoc $GRPC_PLUGIN $API_DOCS,core.md --proto_path=$PROJECT $GRPC/coreapi/api.proto
protoc $GRPC_PLUGIN $API_DOCS,service.md --proto_path=$PROJECT $GRPC/serviceapi/api.proto

0 comments on commit 5fc2cf0

Please sign in to comment.