Migrate tool dependencies to go.tools.mod (#14646)

Go 1.14 introduces usage of alternate go.mod files to track
other dependencies which are not related to the main app.
We use this to track all tool dependencies so that everybody uses
the same version of all tools, including CI.

This will prevent version conflicts due to everybody using different
versions of the tools.
And it will not try to upgrade the tool version, every single time,
one runs the tool command.

While here, we also re-generate some filestore mocks which weren't up to date.

Fixes #13088

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Agniva De Sarker
2020-05-25 23:20:44 +05:30
committed by GitHub
parent 25fb1296af
commit 932d6c2cbf
6 changed files with 193 additions and 41 deletions

View File

@@ -200,41 +200,41 @@ endif
endif
app-layers: ## Extract interface from App struct
env GO111MODULE=off $(GO) get gopkg.in/reflog/struct2interface.v0
$(GOBIN)/struct2interface.v0 -f "app" -o "app/app_iface.go" -p "app" -s "App" -i "AppIface" -t ./app/layer_generators/app_iface.go.tmpl
$(GO) get -modfile=go.tools.mod github.com/reflog/struct2interface
$(GOBIN)/struct2interface -f "app" -o "app/app_iface.go" -p "app" -s "App" -i "AppIface" -t ./app/layer_generators/app_iface.go.tmpl
$(GO) run ./app/layer_generators -in ./app/app_iface.go -out ./app/opentracing_layer.go -template ./app/layer_generators/opentracing_layer.go.tmpl
i18n-extract: ## Extract strings for translation from the source code
env GO111MODULE=off $(GO) get -u github.com/mattermost/mattermost-utilities/mmgotool
$(GO) get -modfile=go.tools.mod github.com/mattermost/mattermost-utilities/mmgotool
$(GOBIN)/mmgotool i18n extract
store-mocks: ## Creates mock files.
env GO111MODULE=off $(GO) get -u github.com/vektra/mockery/...
$(GO) get -modfile=go.tools.mod github.com/vektra/mockery/...
$(GOBIN)/mockery -dir store -all -output store/storetest/mocks -note 'Regenerate this file using `make store-mocks`.'
store-layers: ## Generate layers for the store
$(GO) generate $(GOFLAGS) ./store
filesstore-mocks: ## Creates mock files.
env GO111MODULE=off $(GO) get -u github.com/vektra/mockery/...
$(GO) get -modfile=go.tools.mod github.com/vektra/mockery/...
$(GOBIN)/mockery -dir services/filesstore -all -output services/filesstore/mocks -note 'Regenerate this file using `make filesstore-mocks`.'
ldap-mocks: ## Creates mock files for ldap.
env GO111MODULE=off $(GO) get -u github.com/vektra/mockery/...
$(GO) get -modfile=go.tools.mod github.com/vektra/mockery/...
$(GOBIN)/mockery -dir enterprise/ldap -all -output enterprise/ldap/mocks -note 'Regenerate this file using `make ldap-mocks`.'
plugin-mocks: ## Creates mock files for plugins.
env GO111MODULE=off $(GO) get -u github.com/vektra/mockery/...
$(GO) get -modfile=go.tools.mod github.com/vektra/mockery/...
$(GOBIN)/mockery -dir plugin -name API -output plugin/plugintest -outpkg plugintest -case underscore -note 'Regenerate this file using `make plugin-mocks`.'
$(GOBIN)/mockery -dir plugin -name Hooks -output plugin/plugintest -outpkg plugintest -case underscore -note 'Regenerate this file using `make plugin-mocks`.'
$(GOBIN)/mockery -dir plugin -name Helpers -output plugin/plugintest -outpkg plugintest -case underscore -note 'Regenerate this file using `make plugin-mocks`.'
einterfaces-mocks: ## Creates mock files for einterfaces.
env GO111MODULE=off $(GO) get -u github.com/vektra/mockery/...
$(GO) get -modfile=go.tools.mod github.com/vektra/mockery/...
$(GOBIN)/mockery -dir einterfaces -all -output einterfaces/mocks -note 'Regenerate this file using `make einterfaces-mocks`.'
searchengine-mocks: ## Creates mock files for searchengines.
env GO111MODULE=off go get -u github.com/vektra/mockery/...
$(GO) get -modfile=go.tools.mod github.com/vektra/mockery/...
$(GOBIN)/mockery -dir services/searchengine -all -output services/searchengine/mocks -note 'Regenerate this file using `make searchengine-mocks`.'
pluginapi: ## Generates api and hooks glue code for plugins
@@ -282,7 +282,7 @@ do-cover-file: ## Creates the test coverage report file.
@echo "mode: count" > cover.out
go-junit-report:
env GO111MODULE=off $(GO) get -u github.com/jstemmer/go-junit-report
$(GO) get -modfile=go.tools.mod github.com/jstemmer/go-junit-report
test-compile: ## Compile tests.
@echo COMPILE TESTS