Skip to content

Commit

Permalink
Replace dep with mod which is golang new dependency management system
Browse files Browse the repository at this point in the history
Signed-off-by: xiancli <xiancli@ebay.com>
  • Loading branch information
xiancli committed Dec 25, 2019
1 parent a743757 commit 045e746
Show file tree
Hide file tree
Showing 10 changed files with 235 additions and 788 deletions.
743 changes: 0 additions & 743 deletions Gopkg.lock

This file was deleted.

33 changes: 0 additions & 33 deletions Gopkg.toml

This file was deleted.

2 changes: 1 addition & 1 deletion dev/RnD/chopsim/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"log"
"os"

"github.com/altinity/clickhouse-operator/utils/chopsim/parser"
"github.com/Altinity/clickhouse-operator/dev/RnD/chopsim/parser"
"gopkg.in/yaml.v2"
)

Expand Down
3 changes: 2 additions & 1 deletion dev/go_build_metrics_exporter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ source "${CUR_DIR}/go_build_config.sh"
"${MANIFESTS_ROOT}/operator/build-clickhouse-operator-install-yaml.sh"

#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${CUR_DIR}/clickhouse-operator ${SRC_ROOT}/cmd/clickhouse-operator
if CGO_ENABLED=0 go build \
if CGO_ENABLED=0 GO111MODULE=on go build \
-mod=vendor \
-a \
-ldflags "-X ${REPO}/pkg/version.Version=${VERSION} -X ${REPO}/pkg/version.GitSHA=${GIT_SHA}" \
-o "${METRICS_EXPORTER_BIN}" \
Expand Down
3 changes: 2 additions & 1 deletion dev/go_build_operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ source "${CUR_DIR}/go_build_config.sh"
"${MANIFESTS_ROOT}/operator/build-clickhouse-operator-install-yaml.sh"

#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${CUR_DIR}/clickhouse-operator ${SRC_ROOT}/cmd/clickhouse-operator
if CGO_ENABLED=0 go build \
if CGO_ENABLED=0 GO111MODULE=on go build \
-mod=vendor \
-a \
-ldflags "-X ${REPO}/pkg/version.Version=${VERSION} -X ${REPO}/pkg/version.GitSHA=${GIT_SHA}" \
-o "${OPERATOR_BIN}" \
Expand Down
6 changes: 3 additions & 3 deletions dockerfile/metrics-exporter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ RUN echo "WORKDIR=$GOPATH/src/github.com/altinity/clickhouse-operator"
# Reconstruct source tree inside docker
WORKDIR $GOPATH/src/github.com/altinity/clickhouse-operator
ADD . .
# ./vendor is excluded in .dockerignore, reconstruct it with 'dep' tool
RUN go get -u github.com/golang/dep/cmd/dep
RUN dep ensure --vendor-only
# ./vendor is excluded in .dockerignore, reconstruct it with 'mod' tool
RUN GO111MODULE=on go mod tidy
RUN GO111MODULE=on go mod vendor

# Build operator binary with explicitly specified output
RUN METRICS_EXPORTER_BIN=/tmp/metrics-exporter ./dev/go_build_metrics_exporter.sh
Expand Down
6 changes: 3 additions & 3 deletions dockerfile/operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ RUN echo "WORKDIR=$GOPATH/src/github.com/altinity/clickhouse-operator"
# Reconstruct source tree inside docker
WORKDIR $GOPATH/src/github.com/altinity/clickhouse-operator
ADD . .
# ./vendor is excluded in .dockerignore, reconstruct it with 'dep' tool
RUN go get -u github.com/golang/dep/cmd/dep
RUN dep ensure --vendor-only
# ./vendor is excluded in .dockerignore, reconstruct it with 'mod' tool
RUN GO111MODULE=on go mod tidy
RUN GO111MODULE=on go mod vendor

# Build operator binary with explicitly specified output
RUN OPERATOR_BIN=/tmp/clickhouse-operator ./dev/go_build_operator.sh
Expand Down
6 changes: 3 additions & 3 deletions docs/operator_build_from_sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
## Requirements

1. `go-lang` compiler
2. `dep` Package Manager
2. `mod` Package Manager
3. Get the sources from our repository using `go` git wrapper `go get github.com/Altinity/clickhouse-operator`

## Binary Build Procedure

1. Switch working dir to `src/github.com/Altinity/clickhouse-operator`
2. Make sure all packages are linked properly by using `dep` package manager: `dep ensure --vendor-only` (you can also install `dep` with `go` like so: `go get -u github.com/golang/dep/cmd/dep`)
3. Build the sources `go build -o ./clickhouse-operator ./cmd/clickhouse-operator`. This will create `clickhouse-operator` binary which could be only used inside kubernetes environment.
2. Make sure all packages are linked properly by using `mod` package manager: `go mod tidy`
3. Build the sources `go build -o ./clickhouse-operator cmd/operator/main.go`. This will create `clickhouse-operator` binary which could be only used inside kubernetes environment.

## Docker Image Build and Usage Procedure

Expand Down
40 changes: 40 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module github.com/Altinity/clickhouse-operator

go 1.13

require (
github.com/MakeNowJust/heredoc v1.0.0
github.com/altinity/clickhouse-operator v0.0.0-20191203104409-a7437572b651
github.com/d4l3k/messagediff v1.2.1 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/googleapis/gnostic v0.3.1 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/imdario/mergo v0.3.8
github.com/kubernetes-sigs/yaml v1.1.0
github.com/mailru/go-clickhouse v1.2.0
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/prometheus/client_golang v1.2.1
github.com/r3labs/diff v0.0.0-20191120142937-b4ed99a31f5a
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
gopkg.in/d4l3k/messagediff.v1 v1.2.1
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.2.7
k8s.io/api v0.17.0
k8s.io/apimachinery v0.17.0
k8s.io/client-go v11.0.0+incompatible
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a // indirect
)

replace (
k8s.io/api => k8s.io/api v0.0.0-20190226173710-145d52631d00
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc
k8s.io/client-go => k8s.io/client-go v0.0.0-20190226174127-78295b709ec6
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20181128191024-b1289fc74931
k8s.io/gengo => k8s.io/gengo v0.0.0-20190308184658-b90029ef6cd8
)
Loading

0 comments on commit 045e746

Please sign in to comment.