mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 08:16:59 -06:00
chore: Updating linter, fixing some new warnings (#88863)
This commit is contained in:
parent
c9778c3332
commit
e21d357d67
@ -35,11 +35,11 @@ $(DRONE): $(BINGO_DIR)/drone.mod
|
||||
@echo "(re)installing $(GOBIN)/drone-v1.5.0"
|
||||
@cd $(BINGO_DIR) && GOWORK=off CGO_ENABLED=0 $(GO) build -mod=mod -modfile=drone.mod -o=$(GOBIN)/drone-v1.5.0 "github.com/drone/drone-cli/drone"
|
||||
|
||||
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.57.1
|
||||
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.59.0
|
||||
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
|
||||
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
|
||||
@echo "(re)installing $(GOBIN)/golangci-lint-v1.57.1"
|
||||
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.57.1 "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
@echo "(re)installing $(GOBIN)/golangci-lint-v1.59.0"
|
||||
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.59.0 "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
|
||||
JB := $(GOBIN)/jb-v0.5.1
|
||||
$(JB): $(BINGO_DIR)/jb.mod
|
||||
|
@ -46,7 +46,6 @@ github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB
|
||||
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
|
||||
github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
|
||||
github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
|
||||
github.com/Microsoft/go-winio v0.4.17 h1:iT12IBVClFevaf8PuVyi3UmZOVh4OqnaLxDTW2O6j3w=
|
||||
github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
|
||||
github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
|
||||
github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
|
||||
@ -879,7 +878,6 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
|
@ -1,7 +1,7 @@
|
||||
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
|
||||
|
||||
go 1.21
|
||||
go 1.22
|
||||
|
||||
toolchain go1.21.9
|
||||
toolchain go1.22.4
|
||||
|
||||
require github.com/golangci/golangci-lint v1.57.1 // cmd/golangci-lint
|
||||
require github.com/golangci/golangci-lint v1.59.0 // cmd/golangci-lint
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@ CUE="${GOBIN}/cue-v0.5.0"
|
||||
|
||||
DRONE="${GOBIN}/drone-v1.5.0"
|
||||
|
||||
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.57.1"
|
||||
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.59.0"
|
||||
|
||||
JB="${GOBIN}/jb-v0.5.1"
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
[run]
|
||||
timeout = "10m"
|
||||
concurrency = 10
|
||||
|
||||
[linters-settings.exhaustive]
|
||||
default-signifies-exhaustive = true
|
||||
@ -120,6 +121,9 @@ enabled-checks = ["ruleguard"]
|
||||
[linters-settings.gocritic.settings.ruleguard]
|
||||
rules = "pkg/ruleguard.rules.go"
|
||||
|
||||
[linters-settings.misspell]
|
||||
ignore-words = ["Unknwon", "Creater"]
|
||||
|
||||
[linters-settings.nakedret]
|
||||
max-func-lines = 60
|
||||
|
||||
@ -162,6 +166,7 @@ enable = [
|
||||
|
||||
[issues]
|
||||
exclude-use-default = false
|
||||
max-same-issues = 0
|
||||
|
||||
# Enable when appropriate
|
||||
# Poorly chosen identifier
|
||||
@ -234,10 +239,6 @@ text = "501"
|
||||
linters = ["gosec"]
|
||||
text = "404"
|
||||
|
||||
[[issues.exclude-rules]]
|
||||
linters = ["misspell"]
|
||||
text = "Unknwon` is a misspelling of `Unknown"
|
||||
|
||||
[[issues.exclude-rules]]
|
||||
linters = ["errorlint"]
|
||||
text = "non-wrapping format verb for fmt.Errorf"
|
||||
|
@ -51,7 +51,7 @@ func validateInput(c utils.CommandLine) error {
|
||||
|
||||
fileInfo, err := os.Stat(pluginsDir)
|
||||
if err != nil {
|
||||
if err = os.MkdirAll(pluginsDir, os.ModePerm); err != nil {
|
||||
if err = os.MkdirAll(pluginsDir, 0o750); err != nil {
|
||||
return fmt.Errorf("pluginsDir (%s) is not a writable directory", pluginsDir)
|
||||
}
|
||||
return nil
|
||||
|
@ -113,7 +113,7 @@ func runTests(createCases func() []fsTestCase, t *testing.T) {
|
||||
}
|
||||
|
||||
nestedPath := path.Join("a", "b")
|
||||
err = os.MkdirAll(path.Join(tmpDir, nestedPath), os.ModePerm)
|
||||
err = os.MkdirAll(path.Join(tmpDir, nestedPath), 0o750)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) error {
|
||||
case "file":
|
||||
fileName := sec.Key("file_name").MustString(filepath.Join(logsPath, "grafana.log"))
|
||||
dpath := filepath.Dir(fileName)
|
||||
if err := os.MkdirAll(dpath, os.ModePerm); err != nil {
|
||||
if err := os.MkdirAll(dpath, 0o750); err != nil {
|
||||
_ = level.Error(root).Log("Failed to create directory", "dpath", dpath, "err", err)
|
||||
continue
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ func TestLocalFS_Remove(t *testing.T) {
|
||||
|
||||
t.Run("Uninstall will search in nested dist folder for plugin.json", func(t *testing.T) {
|
||||
pluginDistDir := filepath.Join(t.TempDir(), "dist")
|
||||
err = os.Mkdir(pluginDistDir, os.ModePerm)
|
||||
err = os.Mkdir(pluginDistDir, 0o750)
|
||||
require.NoError(t, err)
|
||||
pluginJSON = filepath.Join(pluginDistDir, "plugin.json")
|
||||
//nolint:gosec
|
||||
@ -59,7 +59,7 @@ func TestLocalFS_Remove(t *testing.T) {
|
||||
|
||||
t.Run("Uninstall will not delete folder if cannot recognize plugin structure", func(t *testing.T) {
|
||||
pluginDir = filepath.Join(t.TempDir(), "system32")
|
||||
err = os.Mkdir(pluginDir, os.ModePerm)
|
||||
err = os.Mkdir(pluginDir, 0o750)
|
||||
require.NoError(t, err)
|
||||
testFile := filepath.Join(pluginDir, "important.exe")
|
||||
//nolint:gosec
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
|
||||
func TestAdd(t *testing.T) {
|
||||
testDir := "./testdata/tmpInstallPluginDir"
|
||||
err := os.MkdirAll(testDir, os.ModePerm)
|
||||
err := os.MkdirAll(testDir, 0o750)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Cleanup(func() {
|
||||
|
@ -192,7 +192,7 @@ func (dbCfg *DatabaseConfig) buildConnectionString(cfg *setting.Cfg, features fe
|
||||
if !filepath.IsAbs(dbCfg.Path) {
|
||||
dbCfg.Path = filepath.Join(cfg.DataPath, dbCfg.Path)
|
||||
}
|
||||
if err := os.MkdirAll(path.Dir(dbCfg.Path), os.ModePerm); err != nil {
|
||||
if err := os.MkdirAll(path.Dir(dbCfg.Path), 0o750); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -1245,7 +1245,7 @@ func (nc *mockNotificationChannel) ServeHTTP(res http.ResponseWriter, req *http.
|
||||
nc.receivedNotifications[key] = append(nc.receivedNotifications[key], body)
|
||||
res.Header().Set("Content-Type", "application/json")
|
||||
res.WriteHeader(http.StatusOK)
|
||||
fmt.Fprint(res, nc.responses[paths[0]])
|
||||
_, _ = fmt.Fprint(res, nc.responses[paths[0]])
|
||||
}
|
||||
|
||||
func (nc *mockNotificationChannel) totalNotifications() int {
|
||||
|
Loading…
Reference in New Issue
Block a user