Browse Source

Merge pull request #13031 from bergquist/golang_1.11

upgrade to golang 1.11
Leonard Gram 7 years ago
parent
commit
5d87aa2fa4

+ 6 - 6
.circleci/config.yml

@@ -19,7 +19,7 @@ version: 2
 jobs:
   mysql-integration-test:
     docker:
-      - image: circleci/golang:1.10
+      - image: circleci/golang:1.11
       - image: circleci/mysql:5.6-ram
         environment:
           MYSQL_ROOT_PASSWORD: rootpass
@@ -39,7 +39,7 @@ jobs:
 
   postgres-integration-test:
     docker:
-      - image: circleci/golang:1.10
+      - image: circleci/golang:1.11
       - image: circleci/postgres:9.3-ram
         environment:
           POSTGRES_USER: grafanatest
@@ -74,7 +74,7 @@ jobs:
 
   gometalinter:
     docker:
-      - image: circleci/golang:1.10
+      - image: circleci/golang:1.11
         environment:
           # we need CGO because of go-sqlite3
           CGO_ENABLED: 1
@@ -115,7 +115,7 @@ jobs:
 
   test-backend:
     docker:
-      - image: circleci/golang:1.10
+      - image: circleci/golang:1.11
     working_directory: /go/src/github.com/grafana/grafana
     steps:
       - checkout
@@ -125,7 +125,7 @@ jobs:
 
   build-all:
     docker:
-     - image: grafana/build-container:1.0.0
+     - image: grafana/build-container:1.1.0
     working_directory: /go/src/github.com/grafana/grafana
     steps:
       - checkout
@@ -168,7 +168,7 @@ jobs:
 
   build:
     docker:
-     - image: grafana/build-container:1.0.0
+     - image: grafana/build-container:1.1.0
     working_directory: /go/src/github.com/grafana/grafana
     steps:
       - checkout

+ 1 - 1
Dockerfile

@@ -1,5 +1,5 @@
 # Golang build container
-FROM golang:1.10
+FROM golang:1.11
 
 WORKDIR $GOPATH/src/github.com/grafana/grafana
 

+ 1 - 1
README.md

@@ -24,7 +24,7 @@ the latest master builds [here](https://grafana.com/grafana/download)
 
 ### Dependencies
 
-- Go 1.10
+- Go 1.11
 - NodeJS LTS
 
 ### Building the backend

+ 1 - 1
appveyor.yml

@@ -7,7 +7,7 @@ clone_folder: c:\gopath\src\github.com\grafana\grafana
 environment:
   nodejs_version: "6"
   GOPATH: C:\gopath
-  GOVERSION: 1.10
+  GOVERSION: 1.11
 
 install:
   - rmdir c:\go /s /q

+ 1 - 1
docs/sources/project/building_from_source.md

@@ -13,7 +13,7 @@ dev environment. Grafana ships with its own required backend server; also comple
 
 ## Dependencies
 
-- [Go 1.10](https://golang.org/dl/)
+- [Go 1.11](https://golang.org/dl/)
 - [Git](https://git-scm.com/downloads)
 - [NodeJS LTS](https://nodejs.org/download/)
 - node-gyp is the Node.js native addon build tool and it requires extra dependencies: python 2.7, make and GCC. These are already installed for most Linux distros and MacOS. See the Building On Windows section or the [node-gyp installation instructions](https://github.com/nodejs/node-gyp#installation) for more details.

+ 1 - 1
pkg/api/live/conn.go

@@ -70,7 +70,7 @@ func (c *connection) readPump() {
 func (c *connection) handleMessage(message []byte) {
 	json, err := simplejson.NewJson(message)
 	if err != nil {
-		log.Error(3, "Unreadable message on websocket channel:", err)
+		log.Error(3, "Unreadable message on websocket channel. error: %v", err)
 	}
 
 	msgType := json.Get("action").MustString()

+ 2 - 2
pkg/cmd/grafana-cli/services/services.go

@@ -63,7 +63,7 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) {
 	var data m.PluginRepo
 	err = json.Unmarshal(body, &data)
 	if err != nil {
-		logger.Info("Failed to unmarshal graphite response error: %v", err)
+		logger.Info("Failed to unmarshal graphite response error:", err)
 		return m.PluginRepo{}, err
 	}
 
@@ -140,7 +140,7 @@ func GetPlugin(pluginId, repoUrl string) (m.Plugin, error) {
 	var data m.Plugin
 	err = json.Unmarshal(body, &data)
 	if err != nil {
-		logger.Info("Failed to unmarshal graphite response error: %v", err)
+		logger.Info("Failed to unmarshal graphite response error:", err)
 		return m.Plugin{}, err
 	}
 

+ 1 - 1
pkg/components/imguploader/s3uploader.go

@@ -60,7 +60,7 @@ func (u *S3Uploader) Upload(ctx context.Context, imageDiskPath string) (string,
 	s3_endpoint, _ := endpoints.DefaultResolver().EndpointFor("s3", u.region)
 	key := u.path + util.GetRandomString(20) + ".png"
 	image_url := s3_endpoint.URL + "/" + u.bucket + "/" + key
-	log.Debug("Uploading image to s3", "url = ", image_url)
+	log.Debug("Uploading image to s3. url = %s", image_url)
 
 	file, err := os.Open(imageDiskPath)
 	if err != nil {

+ 1 - 1
pkg/log/log.go

@@ -105,7 +105,7 @@ func Critical(skip int, format string, v ...interface{}) {
 }
 
 func Fatal(skip int, format string, v ...interface{}) {
-	Root.Crit(fmt.Sprintf(format, v))
+	Root.Crit(fmt.Sprintf(format, v...))
 	Close()
 	os.Exit(1)
 }

+ 2 - 2
pkg/login/ext_user.go

@@ -35,7 +35,7 @@ func UpsertUser(cmd *m.UpsertUserCommand) error {
 
 		limitReached, err := quota.QuotaReached(cmd.ReqContext, "user")
 		if err != nil {
-			log.Warn("Error getting user quota", "err", err)
+			log.Warn("Error getting user quota. error: %v", err)
 			return ErrGettingUserQuota
 		}
 		if limitReached {
@@ -135,7 +135,7 @@ func updateUser(user *m.User, extUser *m.ExternalUserInfo) error {
 		return nil
 	}
 
-	log.Debug("Syncing user info", "id", user.Id, "update", updateCmd)
+	log.Debug2("Syncing user info", "id", user.Id, "update", updateCmd)
 	return bus.Dispatch(updateCmd)
 }
 

+ 3 - 3
pkg/middleware/auth_proxy.go

@@ -36,7 +36,7 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
 
 	// initialize session
 	if err := ctx.Session.Start(ctx.Context); err != nil {
-		log.Error(3, "Failed to start session", err)
+		log.Error(3, "Failed to start session. error %v", err)
 		return false
 	}
 
@@ -146,12 +146,12 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
 	if getRequestUserId(ctx) > 0 && getRequestUserId(ctx) != query.Result.UserId {
 		// remove session
 		if err := ctx.Session.Destory(ctx.Context); err != nil {
-			log.Error(3, "Failed to destroy session, err")
+			log.Error(3, "Failed to destroy session. error: %v", err)
 		}
 
 		// initialize a new session
 		if err := ctx.Session.Start(ctx.Context); err != nil {
-			log.Error(3, "Failed to start session", err)
+			log.Error(3, "Failed to start session. error: %v", err)
 		}
 	}
 

+ 16 - 16
pkg/models/datasource.go

@@ -59,22 +59,22 @@ type DataSource struct {
 }
 
 var knownDatasourcePlugins = map[string]bool{
-	DS_ES:                       true,
-	DS_GRAPHITE:                 true,
-	DS_INFLUXDB:                 true,
-	DS_INFLUXDB_08:              true,
-	DS_KAIROSDB:                 true,
-	DS_CLOUDWATCH:               true,
-	DS_PROMETHEUS:               true,
-	DS_OPENTSDB:                 true,
-	DS_POSTGRES:                 true,
-	DS_MYSQL:                    true,
-	DS_MSSQL:                    true,
-	"opennms":                   true,
-	"abhisant-druid-datasource": true,
-	"dalmatinerdb-datasource":   true,
-	"gnocci":                    true,
-	"zabbix":                    true,
+	DS_ES:                                 true,
+	DS_GRAPHITE:                           true,
+	DS_INFLUXDB:                           true,
+	DS_INFLUXDB_08:                        true,
+	DS_KAIROSDB:                           true,
+	DS_CLOUDWATCH:                         true,
+	DS_PROMETHEUS:                         true,
+	DS_OPENTSDB:                           true,
+	DS_POSTGRES:                           true,
+	DS_MYSQL:                              true,
+	DS_MSSQL:                              true,
+	"opennms":                             true,
+	"abhisant-druid-datasource":           true,
+	"dalmatinerdb-datasource":             true,
+	"gnocci":                              true,
+	"zabbix":                              true,
 	"alexanderzobnin-zabbix-datasource":   true,
 	"newrelic-app":                        true,
 	"grafana-datadog-datasource":          true,

+ 1 - 1
pkg/services/alerting/notifiers/telegram.go

@@ -216,7 +216,7 @@ func appendIfPossible(message string, extra string, sizeLimit int) string {
 	if len(extra)+len(message) <= sizeLimit {
 		return message + extra
 	}
-	log.Debug("Line too long for image caption.", "value", extra)
+	log.Debug("Line too long for image caption. value: %s", extra)
 	return message
 }
 

+ 1 - 1
pkg/services/sqlstore/sqlstore.go

@@ -106,7 +106,7 @@ func (ss *SqlStore) inTransactionWithRetryCtx(ctx context.Context, callback dbTr
 	if len(sess.events) > 0 {
 		for _, e := range sess.events {
 			if err = bus.Publish(e); err != nil {
-				log.Error(3, "Failed to publish event after commit", err)
+				log.Error(3, "Failed to publish event after commit. error: %v", err)
 			}
 		}
 	}

+ 1 - 1
pkg/services/sqlstore/transactions.go

@@ -89,7 +89,7 @@ func inTransactionWithRetryCtx(ctx context.Context, callback dbTransactionFunc,
 	if len(sess.events) > 0 {
 		for _, e := range sess.events {
 			if err = bus.Publish(e); err != nil {
-				log.Error(3, "Failed to publish event after commit", err)
+				log.Error(3, "Failed to publish event after commit. error: %v", err)
 			}
 		}
 	}

+ 1 - 1
pkg/setting/setting.go

@@ -325,7 +325,7 @@ func getCommandLineProperties(args []string) map[string]string {
 		trimmed := strings.TrimPrefix(arg, "cfg:")
 		parts := strings.Split(trimmed, "=")
 		if len(parts) != 2 {
-			log.Fatal(3, "Invalid command line argument", arg)
+			log.Fatal(3, "Invalid command line argument. argument: %v", arg)
 			return nil
 		}
 

+ 1 - 1
scripts/build/Dockerfile

@@ -21,7 +21,7 @@ RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A170311380
 RUN curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - && \
     yum install -y nodejs --nogpgcheck
 
-ENV GOLANG_VERSION 1.10
+ENV GOLANG_VERSION 1.11
 
 RUN wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo && \
     yum install -y yarn --nogpgcheck && \

+ 4 - 0
scripts/build/build-all.sh

@@ -45,6 +45,10 @@ else
 fi
 echo "Building frontend"
 go run build.go ${OPT} build-frontend
+
+# Load ruby, needed for packing with fpm
+source /etc/profile.d/rvm.sh
+
 echo "Packaging"
 go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only latest
 #removing amd64 phantomjs bin for armv7/arm64 packages

+ 3 - 0
scripts/build/build.sh

@@ -33,5 +33,8 @@ fi
 echo "Building frontend"
 go run build.go ${OPT} build-frontend
 
+# Load ruby, needed for packing with fpm
+source /etc/profile.d/rvm.sh
+
 echo "Packaging"
 go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only latest