From 7966397f1f55a8da34e27c7e3dbe15fac59f7168 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 24 Sep 2019 13:01:53 -0700 Subject: [PATCH] Defaulting to using go modules vendored (#12040) --- Makefile | 13 +++++++------ build/Jenkinsfile.pr | 2 +- config/default.go | 2 +- go.mod | 1 - go.sum | 5 +---- scripts/license-check.sh | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index d76f4ff3af..4cedf9b666 100644 --- a/Makefile +++ b/Makefile @@ -45,8 +45,9 @@ else endif # Golang Flags +export GO111MODULE=on GOPATH ?= $(shell go env GOPATH) -GOFLAGS ?= $(GOFLAGS:) +GOFLAGS ?= $(GOFLAGS:) -mod=vendor GO=go DELVE=dlv LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildNumber=$(BUILD_NUMBER)" @@ -141,7 +142,7 @@ clean-docker: ## Deletes the docker containers for local development. govet: ## Runs govet against all packages. @echo Running GOVET - $(GO) get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow + env GO111MODULE=off $(GO) get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow $(GO) vet $(GOFLAGS) $(ALL_PACKAGES) || exit 1 $(GO) vet -vettool=$(GOPATH)/bin/shadow $(GOFLAGS) $(ALL_PACKAGES) || exit 1 $(GO) run plugin/checker/main.go @@ -151,7 +152,7 @@ gofmt: ## Runs gofmt against all packages. @for package in $(TE_PACKAGES) $(EE_PACKAGES); do \ echo "Checking "$$package; \ - files=$$(go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' $$package); \ + files=$$($(GO) list $(GOFLAGS) -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' $$package); \ if [ "$$files" ]; then \ gofmt_output=$$(gofmt -d -s $$files 2>&1); \ if [ "$$gofmt_output" ]; then \ @@ -180,7 +181,7 @@ store-mocks: ## Creates mock files. $(GOPATH)/bin/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 ./store + $(GO) generate $(GOFLAGS) ./store filesstore-mocks: ## Creates mock files. env GO111MODULE=off go get -u github.com/vektra/mockery/... @@ -201,7 +202,7 @@ einterfaces-mocks: ## Creates mock files for einterfaces. $(GOPATH)/bin/mockery -dir einterfaces -all -output einterfaces/mocks -note 'Regenerate this file using `make einterfaces-mocks`.' pluginapi: ## Generates api and hooks glue code for plugins - go generate ./plugin + $(GO) generate $(GOFLAGS) ./plugin check-licenses: ## Checks license status. ./scripts/license-check.sh $(TE_PACKAGES) $(EE_PACKAGES) @@ -409,7 +410,7 @@ config-ldap: ## Configures LDAP. config-reset: ## Resets the config/config.json file to the default. @echo Resetting configuration to default rm -f config/config.json - OUTPUT_CONFIG=$(PWD)/config/config.json go generate ./config + OUTPUT_CONFIG=$(PWD)/config/config.json $(GO) generate $(GOFLAGS) ./config diff-config: ## Compares default configuration between two mattermost versions @./scripts/diff-config.sh diff --git a/build/Jenkinsfile.pr b/build/Jenkinsfile.pr index 41b41d6a36..ad301819f8 100644 --- a/build/Jenkinsfile.pr +++ b/build/Jenkinsfile.pr @@ -416,4 +416,4 @@ pipeline { cleanWs notFailBuild: true } } -} +} \ No newline at end of file diff --git a/config/default.go b/config/default.go index 4cdb5d6d14..824ccb0d14 100644 --- a/config/default.go +++ b/config/default.go @@ -1,4 +1,4 @@ -//go:generate go run config_generator/main.go +//go:generate go run -mod=vendor config_generator/main.go // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. diff --git a/go.mod b/go.mod index ff2d36a861..1d28dc09cb 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,6 @@ require ( github.com/fortytw2/leaktest v1.3.0 // indirect github.com/fsnotify/fsnotify v1.4.7 github.com/go-gorp/gorp v2.0.0+incompatible // indirect - github.com/go-ldap/ldap v3.0.3+incompatible // indirect github.com/go-redis/redis v6.15.2+incompatible github.com/go-sql-driver/mysql v1.4.1 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 diff --git a/go.sum b/go.sum index b9f77b9f1e..8d60f129f5 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,6 @@ cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.37.1/go.mod h1:SAbnLi6YTSPKSI0dTUEOVLCkyPfKXK8n4ibqiMoj4ok= contrib.go.opencensus.io/exporter/ocagent v0.4.9/go.mod h1:ueLzZcP7LPhPulEBukGn4aLh7Mx9YJwpVJ9nL2FYltw= -git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/Azure/azure-sdk-for-go v26.5.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v11.5.2+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= @@ -25,6 +23,7 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= @@ -88,8 +87,6 @@ github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aev github.com/go-gorp/gorp v2.0.0+incompatible h1:dIQPsBtl6/H1MjVseWuWPXa7ET4p6Dve4j3Hg+UjqYw= github.com/go-gorp/gorp v2.0.0+incompatible/go.mod h1:7IfkAQnO7jfT/9IQ3R9wL1dFhukN6aQxzKTHnkxzA/E= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-ldap/ldap v3.0.3+incompatible h1:HTeSZO8hWMS1Rgb2Ziku6b8a7qRIZZMHjsvuZyatzwk= -github.com/go-ldap/ldap v3.0.3+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-redis/redis v6.15.2+incompatible h1:9SpNVG76gr6InJGxoZ6IuuxaCOQwDAhzyXg+Bs+0Sb4= diff --git a/scripts/license-check.sh b/scripts/license-check.sh index 7c0e06303c..bffd03b49f 100755 --- a/scripts/license-check.sh +++ b/scripts/license-check.sh @@ -3,7 +3,7 @@ set -e IFS=$'\n' count=0 for fileType in GoFiles; do - for file in `go list -f $'{{range .GoFiles}}{{$.Dir}}/{{.}}\n{{end}}' "$@"`; do + for file in `go list -mod=vendor -f $'{{range .GoFiles}}{{$.Dir}}/{{.}}\n{{end}}' "$@"`; do case $file in */utils/lru.go|*/utils/imgutils/gif.go|*/store/storetest/mocks/*|*/services/*/mocks/*|*/app/plugin/jira/plugin_*|*/plugin/plugintest/*|*/app/plugin/zoom/plugin_*|*/einterfaces/mocks/*) # Third-party, doesn't require a header.