Chore: Upgrade Go to 1.19.2 (#56857)
We also need to upgrade the linter together with the Go version, all the changes should relate to either fixing linting problems or upgrading the Go version used to build Grafana.
This commit is contained in:
+2
-1
@@ -1,7 +1,8 @@
|
||||
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
|
||||
|
||||
go 1.17
|
||||
go 1.19
|
||||
|
||||
replace github.com/docker/docker => github.com/docker/engine v17.12.0-ce-rc1.0.20200309214505-aa6a9891b09c+incompatible
|
||||
|
||||
require github.com/drone/drone-cli v1.4.0 // drone
|
||||
require golang.org/x/sys v0.0.0-20221010170243-090e33056c14
|
||||
|
||||
+3
-1
@@ -1 +1,3 @@
|
||||
module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files.
|
||||
module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files.
|
||||
|
||||
go 1.19
|
||||
|
||||
+191
-191
File diff suppressed because it is too large
Load Diff
@@ -59,6 +59,7 @@ public/css/*.min.css
|
||||
*.sublime-workspace
|
||||
*.swp
|
||||
.idea/
|
||||
.fleet/
|
||||
*.iml
|
||||
*.tmp
|
||||
.DS_Store
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ COPY emails emails
|
||||
ENV NODE_ENV production
|
||||
RUN yarn build
|
||||
|
||||
FROM golang:1.17.11-alpine3.15 as go-builder
|
||||
FROM golang:1.19.2-alpine3.15 as go-builder
|
||||
|
||||
RUN apk add --no-cache gcc g++ make
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ COPY emails emails
|
||||
ENV NODE_ENV production
|
||||
RUN yarn build
|
||||
|
||||
FROM golang:1.17.11 AS go-builder
|
||||
FROM golang:1.19.2 AS go-builder
|
||||
|
||||
WORKDIR /src/grafana
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -25,5 +25,6 @@ func hello(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", hello)
|
||||
//nolint:gosec
|
||||
log.Fatal(http.ListenAndServe(":3010", nil))
|
||||
}
|
||||
|
||||
@@ -47,5 +47,6 @@ func main() {
|
||||
proxy.ServeHTTP(w, r)
|
||||
})
|
||||
|
||||
//nolint:gosec
|
||||
log.Fatal(http.ListenAndServe(":3011", nil))
|
||||
}
|
||||
|
||||
+2
-2
@@ -553,7 +553,7 @@ func (hs *HTTPServer) PauseAlert(c *models.ReqContext) response.Response {
|
||||
return response.Error(500, "", err)
|
||||
}
|
||||
|
||||
var resp models.AlertStateType = models.AlertStateUnknown
|
||||
var resp = models.AlertStateUnknown
|
||||
pausedState := "un-paused"
|
||||
if cmd.Paused {
|
||||
resp = models.AlertStatePaused
|
||||
@@ -579,7 +579,7 @@ func (hs *HTTPServer) PauseAllAlerts(c *models.ReqContext) response.Response {
|
||||
return response.Error(500, "Failed to pause alerts", err)
|
||||
}
|
||||
|
||||
var resp models.AlertStateType = models.AlertStatePending
|
||||
var resp = models.AlertStatePending
|
||||
pausedState := "un paused"
|
||||
if updateCmd.Paused {
|
||||
resp = models.AlertStatePaused
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -84,6 +84,7 @@ func mergeSpecs(output string, sources ...string) error {
|
||||
return fmt.Errorf("failed to intend new spec: %w", err)
|
||||
}
|
||||
|
||||
//nolint:gosec
|
||||
f, err = os.Create(output)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create file for new spec: %w", err)
|
||||
|
||||
@@ -2,7 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package frontendlogging
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
|
||||
@@ -3,7 +3,7 @@ package pluginproxy
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
|
||||
@@ -2,7 +2,7 @@ package pluginproxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
@@ -3,7 +3,7 @@ package pluginproxy
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
||||
@@ -49,6 +49,7 @@ func shaFile(file string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
//nolint:gosec
|
||||
out, err := os.Create(file + ".sha256")
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -77,6 +78,7 @@ func md5File(file string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
//nolint:gosec
|
||||
out, err := os.Create(file + ".md5")
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
)
|
||||
|
||||
|
||||
@@ -97,6 +97,10 @@ func RunServer(opt ServerOptions) int {
|
||||
fmt.Println("diagnostics: pprof profiling enabled", "addr", profileDiagnostics.addr, "port", profileDiagnostics.port)
|
||||
runtime.SetBlockProfileRate(1)
|
||||
go func() {
|
||||
// TODO: We should enable the linter and fix G114 here.
|
||||
// G114: Use of net/http serve function that has no support for setting timeouts (gosec)
|
||||
//
|
||||
//nolint:gosec
|
||||
err := http.ListenAndServe(fmt.Sprintf("%s:%d", profileDiagnostics.addr, profileDiagnostics.port), nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"mime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
@@ -3,7 +3,7 @@ package fs
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
@@ -76,6 +76,7 @@ func copyFileContents(src, dst string) (err error) {
|
||||
}
|
||||
}()
|
||||
|
||||
//nolint:gosec
|
||||
out, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package httpclient
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -3,7 +3,7 @@ package httpclient
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ package log
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"runtime"
|
||||
|
||||
@@ -3,7 +3,7 @@ package statscollector
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/mail"
|
||||
"regexp"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"runtime"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package grpcplugin
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"log"
|
||||
|
||||
glog "github.com/grafana/grafana/pkg/infra/log"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
@@ -3,7 +3,7 @@ package installer
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -47,6 +47,7 @@ func TestUninstall(t *testing.T) {
|
||||
|
||||
pluginDir := t.TempDir()
|
||||
pluginJSON := filepath.Join(pluginDir, "plugin.json")
|
||||
//nolint:gosec
|
||||
_, err := os.Create(pluginJSON)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -61,6 +62,7 @@ func TestUninstall(t *testing.T) {
|
||||
err = os.Mkdir(pluginDistDir, os.ModePerm)
|
||||
require.NoError(t, err)
|
||||
pluginJSON = filepath.Join(pluginDistDir, "plugin.json")
|
||||
//nolint:gosec
|
||||
_, err = os.Create(pluginJSON)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"path/filepath"
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -3,7 +3,7 @@ package alerting
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
@@ -3,7 +3,7 @@ package alerting
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
||||
@@ -55,9 +55,7 @@ const (
|
||||
// for the HipChatNotifier
|
||||
func NewHipChatNotifier(model *models.AlertNotification, _ alerting.GetDecryptedValueFn, ns notifications.Service) (alerting.Notifier, error) {
|
||||
url := model.Settings.Get("url").MustString()
|
||||
if strings.HasSuffix(url, "/") {
|
||||
url = url[:len(url)-1]
|
||||
}
|
||||
url = strings.TrimSuffix(url, "/")
|
||||
if url == "" {
|
||||
return nil, alerting.ValidationError{Reason: "Could not find url property in settings"}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
@@ -35,8 +35,8 @@ func (s *AuthService) initClaimExpectations() error {
|
||||
switch value := value.(type) {
|
||||
case []interface{}:
|
||||
for _, val := range value {
|
||||
if val, ok := val.(string); ok {
|
||||
s.expectRegistered.Audience = append(s.expectRegistered.Audience, val)
|
||||
if v, ok := val.(string); ok {
|
||||
s.expectRegistered.Audience = append(s.expectRegistered.Audience, v)
|
||||
} else {
|
||||
return fmt.Errorf("%q expectation contains value with invalid type %T, string expected", key, val)
|
||||
}
|
||||
@@ -73,8 +73,8 @@ func (s *AuthService) validateClaims(claims models.JWTClaims) error {
|
||||
switch value := value.(type) {
|
||||
case []interface{}:
|
||||
for _, val := range value {
|
||||
if val, ok := val.(string); ok {
|
||||
registeredClaims.Audience = append(registeredClaims.Audience, val)
|
||||
if v, ok := val.(string); ok {
|
||||
registeredClaims.Audience = append(registeredClaims.Audience, v)
|
||||
} else {
|
||||
return fmt.Errorf("%q claim contains value with invalid type %T, string expected", key, val)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package cleanup
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
@@ -29,6 +29,8 @@ import (
|
||||
|
||||
const (
|
||||
InvalidUsernamePassword = "invalid username or password"
|
||||
// False positive.
|
||||
//nolint:gosec
|
||||
InvalidAPIKey = "invalid API key"
|
||||
)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package featuremgmt
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -92,6 +92,7 @@ func isLetterOrNumber(c rune) bool {
|
||||
func asCamelCase(key string) string {
|
||||
parts := strings.FieldsFunc(key, isLetterOrNumber)
|
||||
for idx, part := range parts {
|
||||
//nolint:staticcheck
|
||||
parts[idx] = strings.Title(part)
|
||||
}
|
||||
return strings.Join(parts, "")
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"math"
|
||||
"net"
|
||||
"strconv"
|
||||
|
||||
@@ -2,7 +2,7 @@ package ldap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"sync"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
@@ -3,7 +3,7 @@ package pipeline
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"log"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package definitions
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -531,6 +531,7 @@ func (evalResults Results) AsDataFrame() data.Frame {
|
||||
labelColumns = append(labelColumns, k)
|
||||
}
|
||||
|
||||
//nolint:staticcheck
|
||||
labelColumns = sort.StringSlice(labelColumns)
|
||||
|
||||
frame := data.NewFrame("evaluation results")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package channels
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package channels
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/url"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
@@ -3,7 +3,7 @@ package notifier
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package notifier
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package notifier
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@@ -3,7 +3,7 @@ package notifier
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
@@ -253,7 +253,7 @@ func assertEvalRun(t *testing.T, ch <-chan evalAppliedInfo, tick time.Time, keys
|
||||
case info := <-ch:
|
||||
_, ok := expected[info.alertDefKey]
|
||||
if !ok {
|
||||
t.Fatal(fmt.Sprintf("alert rule: %v should not have been evaluated at: %v", info.alertDefKey, info.now))
|
||||
t.Fatalf("alert rule: %v should not have been evaluated at: %v", info.alertDefKey, info.now)
|
||||
}
|
||||
t.Logf("alert rule: %v evaluated at: %v", info.alertDefKey, info.now)
|
||||
assert.Equal(t, tick, info.now)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
@@ -2,7 +2,7 @@ package notifications
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -3,7 +3,7 @@ package dashboards
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -3,7 +3,7 @@ package datasources
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -3,7 +3,7 @@ package notifiers
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -3,7 +3,7 @@ package plugins
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -3,7 +3,7 @@ package values
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
||||
@@ -173,6 +173,8 @@ func (rs *RenderingService) readFileResponse(ctx context.Context, resp *http.Res
|
||||
resp.Status)
|
||||
}
|
||||
|
||||
// Path comes from configuration.
|
||||
//nolint:gosec
|
||||
out, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -50,6 +50,7 @@ func TestReadDashboard(t *testing.T) {
|
||||
|
||||
update := false
|
||||
savedPath := "testdata/" + input + "-info.json"
|
||||
//nolint:gosec
|
||||
saved, err := os.ReadFile(savedPath)
|
||||
if err != nil {
|
||||
update = true
|
||||
|
||||
@@ -94,6 +94,7 @@ func (m *permissionMigrator) bulkAssignRoles(allRoles []*accesscontrol.Role) err
|
||||
Created: ts,
|
||||
})
|
||||
} else if strings.HasPrefix(role.Name, "managed:builtins") {
|
||||
//nolint:staticcheck
|
||||
builtIn := strings.Title(strings.Split(role.Name, ":")[2])
|
||||
builtInRoleAssignments = append(builtInRoleAssignments, accesscontrol.BuiltinRole{
|
||||
OrgID: role.OrgID,
|
||||
|
||||
@@ -199,6 +199,7 @@ func openReplace(filename string) (*replaceFile, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//nolint:gosec
|
||||
f, err := os.Create(tmpFilename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
|
||||
@@ -3,7 +3,7 @@ package updatechecker
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io/ioutil" //nolint:staticcheck // No need to change in v8.
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user