Skip to content

Commit

Permalink
build: Move to go modules
Browse files Browse the repository at this point in the history
Drop usage of govendor as dependency management tool in favor to
go modules.

Relates #423
  • Loading branch information
litleleprikon authored and beevee committed Oct 3, 2019
1 parent 7ae57ec commit 8f21a0b
Show file tree
Hide file tree
Showing 16 changed files with 712 additions and 1,717 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.idea

vendor
!vendor/vendor.json
build
local

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ build/

.DS_Store
*.coverprofile
/vendor/*/
vendor

.vscode/
.idea/
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile.api
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM golang:1.13.1 as builder

RUN go get github.com/kardianos/govendor

COPY ./vendor/vendor.json /go/src/github.com/moira-alert/moira/vendor/vendor.json
COPY go.mod go.sum /go/src/github.com/moira-alert/moira/
WORKDIR /go/src/github.com/moira-alert/moira
RUN govendor sync
RUN go mod download

COPY . /go/src/github.com/moira-alert/moira/

Expand Down
6 changes: 2 additions & 4 deletions Dockerfile.checker
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM golang:1.13.1 as builder

RUN go get github.com/kardianos/govendor

COPY ./vendor/vendor.json /go/src/github.com/moira-alert/moira/vendor/vendor.json
COPY go.mod go.sum /go/src/github.com/moira-alert/moira/
WORKDIR /go/src/github.com/moira-alert/moira
RUN govendor sync
RUN go mod download

COPY . /go/src/github.com/moira-alert/moira/

Expand Down
6 changes: 2 additions & 4 deletions Dockerfile.filter
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM golang:1.13.1 as builder

RUN go get github.com/kardianos/govendor

COPY ./vendor/vendor.json /go/src/github.com/moira-alert/moira/vendor/vendor.json
COPY go.mod go.sum /go/src/github.com/moira-alert/moira/
WORKDIR /go/src/github.com/moira-alert/moira
RUN govendor sync
RUN go mod download

COPY . /go/src/github.com/moira-alert/moira/

Expand Down
6 changes: 2 additions & 4 deletions Dockerfile.notifier
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM golang:1.13.1 as builder

RUN go get github.com/kardianos/govendor

COPY ./vendor/vendor.json /go/src/github.com/moira-alert/moira/vendor/vendor.json
COPY go.mod go.sum /go/src/github.com/moira-alert/moira/
WORKDIR /go/src/github.com/moira-alert/moira
RUN govendor sync
RUN go mod download

COPY . /go/src/github.com/moira-alert/moira/

Expand Down
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ VERSION_NIGHTLY := ${GIT_COMMIT_DATE}-${GIT_HASH_SHORT}
VERSION_RELEASE := ${GIT_TAG}.${GIT_COMMIT}

GO_VERSION := $(shell go version | cut -d' ' -f3)
GO111MODULE := on

VENDOR := "SKB Kontur"
URL := "https://github.com/moira-alert/moira"
Expand All @@ -21,22 +22,17 @@ LICENSE := "MIT"
.PHONY: default
default: test build

.PHONY: prepare
prepare:
go get -u github.com/kardianos/govendor
govendor sync

.PHONY: lint
lint: prepare
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/[email protected]
lint:
go get github.com/golangci/golangci-lint/cmd/[email protected]
GOGC=30 golangci-lint run

.PHONY: test
test: prepare
echo 'mode: atomic' > coverage.txt && go list ./... | grep -v "/vendor/" | xargs -n1 -I{} sh -c 'go test -v -bench=. -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.txt' && rm coverage.tmp
test:
echo 'mode: atomic' > coverage.txt && go list ./... | xargs -n1 -I{} sh -c 'go test -v -bench=. -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.txt' && rm coverage.tmp

.PHONY: build
build: prepare
build:
for service in "filter" "notifier" "api" "checker" "cli" ; do \
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-X main.MoiraVersion=${VERSION_RELEASE} -X main.GoVersion=${GO_VERSION} -X main.GitCommit=${GIT_HASH}" -o build/$$service github.com/moira-alert/moira/cmd/$$service ; \
done
Expand Down
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@ Other installation methods are available, see [documentation](https://moira.read

## Development

To build and run tests, first get all dependencies:

```bash
go get github.com/kardianos/govendor
govendor sync
```

Then you need local redis listening on port 6379.
To build and run tests you need local redis listening on port 6379.
Easiest way to get redis is via docker:

```bash
Expand Down
2 changes: 1 addition & 1 deletion database/redis/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/gomodule/redigo/redis"
"github.com/patrickmn/go-cache"
"gopkg.in/redsync.v1"
"github.com/go-redsync/redsync"
"gopkg.in/tomb.v2"

"github.com/moira-alert/moira"
Expand Down
2 changes: 1 addition & 1 deletion database/redis/locks.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/moira-alert/moira"
"github.com/moira-alert/moira/database"
"gopkg.in/redsync.v1"
"github.com/go-redsync/redsync"
)

// NewLock returns the implementation of moira.Lock which can be used to Acquire or Release the lock
Expand Down
95 changes: 95 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
module github.com/moira-alert/moira

go 1.13

require (
bitbucket.org/tebeka/strftime v0.0.0-20140926081919-2194253a23c0 // indirect
github.com/FZambia/sentinel v1.0.1-0.20180630101255-52eb51343b45
github.com/JaderDias/movingmedian v0.0.0-20170611140316-de8c410559fa // indirect
github.com/Knetic/govaluate v3.0.1-0.20170815164058-89a078c30383+incompatible
github.com/PagerDuty/go-pagerduty v0.0.0-20190503230806-cf1437c7c8d6
github.com/RoaringBitmap/roaring v0.4.17-0.20180820165455-627b662e6d11 // indirect
github.com/aclements/go-moremath v0.0.0-20190830160640-d16893ddf098 // indirect
github.com/aws/aws-sdk-go v1.20.15-0.20190702192017-e1b61fed9fc0
github.com/beevee/go-chart v2.0.2-0.20190523110126-273a59e48bcc+incompatible
github.com/blend/go-sdk v2.0.0+incompatible // indirect
github.com/blevesearch/bleve v0.7.1-0.20180912193416-f9afd92d0dc4
github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 // indirect
github.com/blevesearch/go-porterstemmer v1.0.2 // indirect
github.com/blevesearch/segment v0.0.0-20160915185041-762005e7a34f // indirect
github.com/boltdb/bolt v1.3.2-0.20180302180052-fd01fc79c553 // indirect
github.com/bwmarrin/discordgo v0.19.1-0.20190513173526-8d8906ce4b95
github.com/carlosdp/twiliogo v0.0.0-20161027183705-b26045ebb9d1
github.com/couchbase/vellum v0.0.0-20180910213445-01d5c56e6095 // indirect
github.com/cyberdelia/go-metrics-graphite v0.0.0-20161219230853-39f87cc3b432
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d // indirect
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 // indirect
github.com/dgryski/go-onlinestats v0.0.0-20170612111826-1c7d19468768 // indirect
github.com/disintegration/imaging v1.4.2 // indirect
github.com/dustin/go-humanize v1.0.0
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect
github.com/evmar/gocairo v0.0.0-20160222165215-ddd30f837497 // indirect
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd // indirect
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 // indirect
github.com/go-chi/chi v3.1.1-0.20170712121200-4c5a584b324b+incompatible
github.com/go-chi/render v1.0.0
github.com/go-graphite/carbonapi v0.0.0-20190604194342-5a4fa2112923
github.com/go-graphite/protocol v0.4.2
github.com/go-redsync/redsync v1.3.1
github.com/gofrs/uuid v3.2.0+incompatible
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/golang/mock v1.2.1-0.20190116182947-c20582278a82
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/golangci/go-tools v0.0.0-20190318055746-e32c54105b7c // indirect
github.com/golangci/golangci-lint v1.19.1 // indirect
github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547 // indirect
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/go-querystring v1.0.1-0.20190318165438-c8c88dbee036 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e // indirect
github.com/gosexy/to v0.0.0-20141221203644-c20e083e3123
github.com/gotokatsuya/ipare v0.0.0-20161202043954-fd52c5b6c44b
github.com/gregdel/pushover v0.0.0-20190217183207-15d3fef40636
github.com/hashicorp/go-cleanhttp v0.5.2-0.20190406162018-d3fcbee8e181 // indirect
github.com/hashicorp/go-retryablehttp v0.5.4 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/karriereat/blackfriday-slack v0.1.0
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/lomik/og-rek v0.0.0-20170411191824-628eefeb8d80 // indirect
github.com/lomik/zapwriter v0.0.0-20180906104450-2ec2b9a61680 // indirect
github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5 // indirect
github.com/lusis/slack-test v0.0.0-20190426140909-c40012f20018 // indirect
github.com/mjibson/go-dsp v0.0.0-20180508042940-11479a337f12 // indirect
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae // indirect
github.com/nlopes/slack v0.4.1-0.20181123205743-38ac5e8c495b
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/opsgenie/opsgenie-go-sdk-v2 v0.0.0-20190710132028-b46b0594268d
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/philhofer/fwd v1.0.0 // indirect
github.com/pkg/errors v0.8.1
github.com/rcrowley/go-metrics v0.0.0-20161128210544-1f30fe9094a5
github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe
github.com/russross/blackfriday/v2 v2.0.1
github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a
github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2 // indirect
github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d // indirect
github.com/tecbot/gorocksdb v0.0.0-20190930194452-65a88f08537a // indirect
github.com/tinylib/msgp v1.0.3-0.20180912221530-f65876d3ea05 // indirect
github.com/vova616/xxhash v0.0.0-20130313230233-f0a9a8b74d48
github.com/wangjohn/quickselect v0.0.0-20161129230411-ed8402a42d5f // indirect
github.com/willf/bitset v1.1.9 // indirect
github.com/writeas/go-strip-markdown v2.0.1+incompatible
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24 // indirect
gonum.org/v1/netlib v0.0.0-20190926062253-2d6e29b73a19 // indirect
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
gopkg.in/tucnak/telebot.v2 v2.0.0-20181115150921-4688194c178d
gopkg.in/yaml.v2 v2.2.3
)
Loading

0 comments on commit 8f21a0b

Please sign in to comment.