From 6a3fdbd489956eb7faeef18bd60edb21b9e3fae4 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Fri, 1 Mar 2019 18:55:35 +0100 Subject: [PATCH] update go to 1.12 (#10382) * update go to 1.12 * update per feedback * fix test * revert test changes * remove zap.AddCallerSkip(1) --- Makefile | 7 +++++-- README.md | 8 ++++---- build/Dockerfile.buildenv | 2 +- build/Jenkinsfile.pr | 4 ++-- build/README.md | 11 +++++++++++ mlog/global_test.go | 2 +- mlog/log.go | 1 - mlog/testing.go | 1 - scripts/prereq-check.sh | 2 +- 9 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 0428ac6f25..9e022c28ff 100644 --- a/Makefile +++ b/Makefile @@ -290,10 +290,13 @@ clean-docker: ## Deletes the docker containers for local development. govet: ## Runs govet against all packages. @echo Running GOVET - $(GO) vet -shadow $(GOFLAGS) $(TE_PACKAGES) || exit 1 + $(GO) get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow + $(GO) vet $(GOFLAGS) $(TE_PACKAGES) || exit 1 + $(GO) vet -vettool=$(which shadow) $(GOFLAGS) $(TE_PACKAGES) || exit 1 ifeq ($(BUILD_ENTERPRISE_READY),true) - $(GO) vet $(GOFLAGS) $(EE_PACKAGES) || exit 1 + $(GO) vet $(GOFLAGS) $(TE_PACKAGES) || exit 1 + $(GO) vet -vettool=$(which shadow) $(GOFLAGS) $(EE_PACKAGES) || exit 1 endif gofmt: ## Runs gofmt against all packages. diff --git a/README.md b/README.md index ec39c8469a..baf791eb44 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,10 @@ _Note: Heroku preview does not include email or persistent storage_ ## Install on Your Own Machine -- [One-line Docker Preview](http://docs.mattermost.com/install/docker-local-machine.html#one-line-docker-install) +- [One-line Docker Preview](http://docs.mattermost.com/install/docker-local-machine.html#one-line-docker-install) - [Developer Machine Setup](https://docs.mattermost.com/developer/dev-setup.html) - [Production Install Guides using Linux Binary](http://www.mattermost.org/installation/) -- [Production Docker Install](https://docs.mattermost.com/install/prod-docker.html) +- [Production Docker Install](https://docs.mattermost.com/install/prod-docker.html) ## Native Mobile and Desktop Apps @@ -41,7 +41,7 @@ In addition to the web interface, you can also download Mattermost clients for [ ## Get Security Bulletins Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you are deploying Mattermost it is highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases. - + - [Subscribe here](https://about.mattermost.com/security-bulletin/) ## Get Involved @@ -58,7 +58,7 @@ Receive notifications of critical security updates. The sophistication of online - [API Options - webhooks, slash commands, drivers and web service](https://api.mattermost.com/) - [See who's using Mattermost](https://about.mattermost.com/success-stories/) -- [Browse over 700 Mattermost integrations](https://about.mattermost.com/community-applications/) +- [Browse over 700 Mattermost integrations](https://about.mattermost.com/community-applications/) ## Get the Latest News diff --git a/build/Dockerfile.buildenv b/build/Dockerfile.buildenv index e6ddfc0574..dbec0a7b0f 100644 --- a/build/Dockerfile.buildenv +++ b/build/Dockerfile.buildenv @@ -1,3 +1,3 @@ -FROM golang:1.11 +FROM golang:1.12 RUN apt-get update && apt-get install -y make git apt-transport-https ca-certificates curl software-properties-common build-essential zip wget xmlsec1 diff --git a/build/Jenkinsfile.pr b/build/Jenkinsfile.pr index 8b4d5d1846..a119ddecb2 100644 --- a/build/Jenkinsfile.pr +++ b/build/Jenkinsfile.pr @@ -77,7 +77,7 @@ pipeline { } steps { - withDockerContainer(args: '-u root --privileged -v ${WORKSPACE}/src:/go/src/', image: 'mattermost/mattermost-build-server:dec-7-2018') { + withDockerContainer(args: '-u root --privileged -v ${WORKSPACE}/src:/go/src/', image: 'mattermost/mattermost-build-server:feb-28-2019') { ansiColor('xterm') { sh """ cd /go/src/github.com/mattermost/mattermost-server @@ -122,7 +122,7 @@ pipeline { } } - withDockerContainer(args: "-u root --privileged --net ${COMPOSE_PROJECT_NAME}_mm-test -v ${WORKSPACE}/src:/go/src/", image: 'mattermost/mattermost-build-server:dec-7-2018') { + withDockerContainer(args: "-u root --privileged --net ${COMPOSE_PROJECT_NAME}_mm-test -v ${WORKSPACE}/src:/go/src/", image: 'mattermost/mattermost-build-server:feb-28-2019') { ansiColor('xterm') { sh """ cd /go/src/github.com/mattermost/mattermost-server diff --git a/build/README.md b/build/README.md index fe0fd83c50..8f8890a9c2 100644 --- a/build/README.md +++ b/build/README.md @@ -6,3 +6,14 @@ PRs opened against the `mattermost-server` repository will use the file called ` The `Dockerfile` in this folder (`Dockerfile.buildenv`) is the build environment for our current builds you can find the docker image to downalod [here](https://hub.docker.com/r/mattermost/mattermost-build-server/tags/) or build your own. + + +### Docker Image for building the Server + +We have a docker image to build `mattermost-server` and it is based on Go docker image. + +In our Docker Hub Repository we have the following images: + +- `mattermost/mattermost-build-server:dec-7-2018` which is based on Go 1.11 you can use for MM versions <= `5.9.0` +- `mattermost/mattermost-build-server:feb-28-2019` which is based on Go 1.12 + diff --git a/mlog/global_test.go b/mlog/global_test.go index c0ac022d04..0068e2eb38 100644 --- a/mlog/global_test.go +++ b/mlog/global_test.go @@ -136,7 +136,7 @@ func TestLoggingAfterInitialized(t *testing.T) { actual = strings.Join(actualRows, "\n") } - require.Equal(t, testCase.ExpectedLogs, strings.Split(actual, "\n")) + require.ElementsMatch(t, testCase.ExpectedLogs, strings.Split(actual, "\n")) } }) } diff --git a/mlog/log.go b/mlog/log.go index e3bc38d83f..dd35a30750 100644 --- a/mlog/log.go +++ b/mlog/log.go @@ -102,7 +102,6 @@ func NewLogger(config *LoggerConfiguration) *Logger { combinedCore := zapcore.NewTee(cores...) logger.zap = zap.New(combinedCore, - zap.AddCallerSkip(1), zap.AddCaller(), ) diff --git a/mlog/testing.go b/mlog/testing.go index 7b03b393e4..1b97c2fb7e 100644 --- a/mlog/testing.go +++ b/mlog/testing.go @@ -35,7 +35,6 @@ func NewTestingLogger(tb testing.TB) *Logger { logWriterCore := zapcore.NewCore(makeEncoder(true), logWriterSync, testingLogger.consoleLevel) testingLogger.zap = zap.New(logWriterCore, - zap.AddCallerSkip(1), zap.AddCaller(), ) return testingLogger diff --git a/scripts/prereq-check.sh b/scripts/prereq-check.sh index ab196f77a5..447c73ff4d 100755 --- a/scripts/prereq-check.sh +++ b/scripts/prereq-check.sh @@ -35,7 +35,7 @@ echo "Checking prerequisites" REQUIREDNODEVERSION=8.9.0 REQUIREDNPMVERSION=5.6.0 -REQUIREDGOVERSION=1.11.0 +REQUIREDGOVERSION=1.12.0 REQUIREDDOCKERVERSION=17.0 NODEVERSION=$(sed 's/v//' <<< $(node -v))