Chore: Fix goimports grouping in pkg/services (#62420)

* fix goimports

* fix goimports order
This commit is contained in:
Serge Zaitsev 2023-01-30 09:21:27 +01:00 committed by GitHub
parent 324310abbc
commit bc2813ef06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 147 additions and 109 deletions

View File

@ -7,7 +7,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -20,6 +19,7 @@ import (
dashboardstore "github.com/grafana/grafana/pkg/services/dashboards/database" dashboardstore "github.com/grafana/grafana/pkg/services/dashboards/database"
"github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/quota/quotatest" "github.com/grafana/grafana/pkg/services/quota/quotatest"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/tag/tagimpl" "github.com/grafana/grafana/pkg/services/tag/tagimpl"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"

View File

@ -4,8 +4,9 @@ import (
"testing" "testing"
"time" "time"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/setting"
) )
func TestCleanUpTmpFiles(t *testing.T) { func TestCleanUpTmpFiles(t *testing.T) {

View File

@ -5,10 +5,10 @@ import (
"strconv" "strconv"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/services/comments/commentmodel" "github.com/grafana/grafana/pkg/services/comments/commentmodel"
"github.com/stretchr/testify/require"
) )
func createSqlStorage(t *testing.T) Storage { func createSqlStorage(t *testing.T) Storage {

View File

@ -7,10 +7,10 @@ import (
"net/http/httptest" "net/http/httptest"
"testing" "testing"
"github.com/grafana/grafana-plugin-sdk-go/backend/gtime"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana-plugin-sdk-go/backend/gtime"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/auth" "github.com/grafana/grafana/pkg/services/auth"
"github.com/grafana/grafana/pkg/services/auth/authtest" "github.com/grafana/grafana/pkg/services/auth/authtest"

View File

@ -5,6 +5,8 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/prometheus/client_golang/prometheus"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/tracing" "github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/models/usertoken" "github.com/grafana/grafana/pkg/models/usertoken"
@ -13,7 +15,6 @@ import (
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/errutil" "github.com/grafana/grafana/pkg/util/errutil"
"github.com/grafana/grafana/pkg/web" "github.com/grafana/grafana/pkg/web"
"github.com/prometheus/client_golang/prometheus"
) )
type ReqContext struct { type ReqContext struct {

View File

@ -4,8 +4,9 @@ import (
"net/http" "net/http"
"testing" "testing"
"github.com/grafana/grafana/pkg/web"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/web"
) )
func TestQueryBoolWithDefault(t *testing.T) { func TestQueryBoolWithDefault(t *testing.T) {

View File

@ -10,7 +10,6 @@ import (
ac "github.com/grafana/grafana/pkg/services/accesscontrol" ac "github.com/grafana/grafana/pkg/services/accesscontrol"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model" contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/grafana/pkg/services/datasources" "github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/web" "github.com/grafana/grafana/pkg/web"
) )

View File

@ -6,7 +6,6 @@ import (
"github.com/grafana/grafana/pkg/api/routing" "github.com/grafana/grafana/pkg/api/routing"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/events" "github.com/grafana/grafana/pkg/events"
"github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol"

View File

@ -7,6 +7,8 @@ import (
"net/http" "net/http"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/api/routing" "github.com/grafana/grafana/pkg/api/routing"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
acmock "github.com/grafana/grafana/pkg/services/accesscontrol/mock" acmock "github.com/grafana/grafana/pkg/services/accesscontrol/mock"
@ -15,7 +17,6 @@ import (
"github.com/grafana/grafana/pkg/services/quota" "github.com/grafana/grafana/pkg/services/quota"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/web/webtest" "github.com/grafana/grafana/pkg/web/webtest"
"github.com/stretchr/testify/require"
) )
func TestImportDashboardAPI(t *testing.T) { func TestImportDashboardAPI(t *testing.T) {

View File

@ -6,6 +6,8 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/services/dashboardimport" "github.com/grafana/grafana/pkg/services/dashboardimport"
"github.com/grafana/grafana/pkg/services/dashboards" "github.com/grafana/grafana/pkg/services/dashboards"
@ -15,7 +17,6 @@ import (
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/plugindashboards" "github.com/grafana/grafana/pkg/services/plugindashboards"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/stretchr/testify/require"
) )
func TestImportDashboardService(t *testing.T) { func TestImportDashboardService(t *testing.T) {

View File

@ -3,9 +3,10 @@ package utils
import ( import (
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/services/dashboardimport" "github.com/grafana/grafana/pkg/services/dashboardimport"
"github.com/stretchr/testify/require"
) )
func TestDashTemplateEvaluator(t *testing.T) { func TestDashTemplateEvaluator(t *testing.T) {

View File

@ -5,8 +5,9 @@ package dashboards
import ( import (
context "context" context "context"
folder "github.com/grafana/grafana/pkg/services/folder"
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
folder "github.com/grafana/grafana/pkg/services/folder"
) )
// FakeDashboardService is an autogenerated mock type for the DashboardService type // FakeDashboardService is an autogenerated mock type for the DashboardService type

View File

@ -5,8 +5,9 @@ package dashboards
import ( import (
context "context" context "context"
folder "github.com/grafana/grafana/pkg/services/folder"
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
folder "github.com/grafana/grafana/pkg/services/folder"
) )
// FakeFolderStore is an autogenerated mock type for the FolderStore type // FakeFolderStore is an autogenerated mock type for the FolderStore type

View File

@ -3,11 +3,12 @@ package dashboards
import ( import (
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/infra/slugify" "github.com/grafana/grafana/pkg/infra/slugify"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
func TestGetDashboardUrl(t *testing.T) { func TestGetDashboardUrl(t *testing.T) {

View File

@ -5,11 +5,10 @@ package dashboards
import ( import (
context "context" context "context"
folder "github.com/grafana/grafana/pkg/services/folder"
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
models "github.com/grafana/grafana/pkg/services/alerting/models" models "github.com/grafana/grafana/pkg/services/alerting/models"
folder "github.com/grafana/grafana/pkg/services/folder"
quota "github.com/grafana/grafana/pkg/services/quota" quota "github.com/grafana/grafana/pkg/services/quota"
) )

View File

@ -5,7 +5,6 @@ import (
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

View File

@ -4,9 +4,10 @@ import (
"context" "context"
"testing" "testing"
"github.com/grafana/grafana/pkg/services/encryption"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/services/encryption"
) )
func Test_aesDecipher(t *testing.T) { func Test_aesDecipher(t *testing.T) {

View File

@ -3,10 +3,11 @@ package service
import ( import (
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/usagestats" "github.com/grafana/grafana/pkg/infra/usagestats"
encryptionprovider "github.com/grafana/grafana/pkg/services/encryption/provider" encryptionprovider "github.com/grafana/grafana/pkg/services/encryption/provider"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require"
) )
func SetupTestService(tb testing.TB) *Service { func SetupTestService(tb testing.TB) *Service {

View File

@ -4,12 +4,13 @@ import (
"context" "context"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/usagestats" "github.com/grafana/grafana/pkg/infra/usagestats"
"github.com/grafana/grafana/pkg/services/encryption" "github.com/grafana/grafana/pkg/services/encryption"
"github.com/grafana/grafana/pkg/services/encryption/provider" "github.com/grafana/grafana/pkg/services/encryption/provider"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
func Test_Service(t *testing.T) { func Test_Service(t *testing.T) {

View File

@ -15,14 +15,13 @@ import (
"github.com/grafana/grafana/pkg/services/dashboards" "github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/folder" "github.com/grafana/grafana/pkg/services/folder"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/services/guardian" "github.com/grafana/grafana/pkg/services/guardian"
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
) )
type Service struct { type Service struct {

View File

@ -8,6 +8,7 @@ import (
"github.com/VividCortex/mysqlerr" "github.com/VividCortex/mysqlerr"
"github.com/go-sql-driver/mysql" "github.com/go-sql-driver/mysql"
"github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/slugify" "github.com/grafana/grafana/pkg/infra/slugify"

View File

@ -3,10 +3,10 @@ package grpcserver
import ( import (
"context" "context"
"github.com/grafana/grafana/pkg/setting"
"google.golang.org/grpc/health" "google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/health/grpc_health_v1"
"github.com/grafana/grafana/pkg/setting"
) )
// HealthService implements GRPC Health Checking Protocol: // HealthService implements GRPC Health Checking Protocol:

View File

@ -4,6 +4,10 @@ import (
"context" "context"
"strings" "strings"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
apikeygenprefix "github.com/grafana/grafana/pkg/components/apikeygenprefixed" apikeygenprefix "github.com/grafana/grafana/pkg/components/apikeygenprefixed"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol"
@ -11,10 +15,6 @@ import (
grpccontext "github.com/grafana/grafana/pkg/services/grpcserver/context" grpccontext "github.com/grafana/grafana/pkg/services/grpcserver/context"
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
) )
type Authenticator interface { type Authenticator interface {

View File

@ -4,6 +4,9 @@ import (
"context" "context"
"testing" "testing"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/metadata"
apikeygenprefix "github.com/grafana/grafana/pkg/components/apikeygenprefixed" apikeygenprefix "github.com/grafana/grafana/pkg/components/apikeygenprefixed"
"github.com/grafana/grafana/pkg/infra/tracing" "github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol"
@ -12,8 +15,6 @@ import (
grpccontext "github.com/grafana/grafana/pkg/services/grpcserver/context" grpccontext "github.com/grafana/grafana/pkg/services/grpcserver/context"
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/metadata"
) )
func TestAuthenticator_Authenticate(t *testing.T) { func TestAuthenticator_Authenticate(t *testing.T) {

View File

@ -3,8 +3,9 @@ package interceptors
import ( import (
"context" "context"
"github.com/grafana/grafana/pkg/infra/tracing"
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/grafana/grafana/pkg/infra/tracing"
) )
const tracingPrefix = "gRPC Server " const tracingPrefix = "gRPC Server "

View File

@ -3,10 +3,10 @@ package grpcserver
import ( import (
"context" "context"
"github.com/grafana/grafana/pkg/setting"
"google.golang.org/grpc/reflection" "google.golang.org/grpc/reflection"
"google.golang.org/grpc/reflection/grpc_reflection_v1alpha" "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
"github.com/grafana/grafana/pkg/setting"
) )
// ReflectionService implements the gRPC Server Reflection Protocol: // ReflectionService implements the gRPC Server Reflection Protocol:

View File

@ -6,17 +6,17 @@ import (
"net" "net"
"github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/backend"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpcAuth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/tracing" "github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/registry" "github.com/grafana/grafana/pkg/registry"
"github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/grpcserver/interceptors" "github.com/grafana/grafana/pkg/services/grpcserver/interceptors"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpcAuth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
) )
type Provider interface { type Provider interface {

View File

@ -4,6 +4,8 @@ import (
"net/http" "net/http"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/models/roletype" "github.com/grafana/grafana/pkg/models/roletype"
"github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/plugins"
@ -18,7 +20,6 @@ import (
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/web" "github.com/grafana/grafana/pkg/web"
"github.com/stretchr/testify/require"
) )
func TestAddAppLinks(t *testing.T) { func TestAddAppLinks(t *testing.T) {

View File

@ -6,10 +6,10 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require"
) )
func TestTimeLimitCodes(t *testing.T) { func TestTimeLimitCodes(t *testing.T) {

View File

@ -5,9 +5,9 @@ import (
"os" "os"
"testing" "testing"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/setting"
) )
func TestEmailIntegrationTest(t *testing.T) { func TestEmailIntegrationTest(t *testing.T) {

View File

@ -8,8 +8,9 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/grafana/grafana/pkg/setting"
gomail "gopkg.in/mail.v2" gomail "gopkg.in/mail.v2"
"github.com/grafana/grafana/pkg/setting"
) )
type SmtpClient struct { type SmtpClient struct {

View File

@ -5,9 +5,10 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/setting"
) )
func TestBuildMail(t *testing.T) { func TestBuildMail(t *testing.T) {

View File

@ -4,10 +4,11 @@ import (
"context" "context"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/quota" "github.com/grafana/grafana/pkg/services/quota"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require"
) )
func TestOrgService(t *testing.T) { func TestOrgService(t *testing.T) {

View File

@ -8,12 +8,13 @@ import (
"sort" "sort"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/plugins/manager/dashboards" "github.com/grafana/grafana/pkg/plugins/manager/dashboards"
dashmodels "github.com/grafana/grafana/pkg/services/dashboards" dashmodels "github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/plugindashboards" "github.com/grafana/grafana/pkg/services/plugindashboards"
"github.com/stretchr/testify/require"
) )
func TestGetPluginDashboards(t *testing.T) { func TestGetPluginDashboards(t *testing.T) {

View File

@ -8,8 +8,9 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/grafana/grafana/pkg/infra/log"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"github.com/grafana/grafana/pkg/infra/log"
) )
type rulesConfigReader struct { type rulesConfigReader struct {

View File

@ -4,8 +4,9 @@ import (
"context" "context"
"testing" "testing"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/log"
) )
const ( const (

View File

@ -3,9 +3,10 @@ package alerting
import ( import (
"testing" "testing"
"github.com/grafana/grafana/pkg/services/provisioning/values"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"github.com/grafana/grafana/pkg/services/provisioning/values"
) )
func TestReceivers(t *testing.T) { func TestReceivers(t *testing.T) {

View File

@ -7,10 +7,10 @@ import (
"strings" "strings"
"time" "time"
"github.com/prometheus/common/model"
"github.com/grafana/grafana/pkg/services/ngalert/models" "github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/services/provisioning/values" "github.com/grafana/grafana/pkg/services/provisioning/values"
"github.com/prometheus/common/model"
) )
type RuleDelete struct { type RuleDelete struct {

View File

@ -4,9 +4,8 @@ import (
"os" "os"
"testing" "testing"
"gopkg.in/yaml.v3"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
) )
func TestNotificationPolicy(t *testing.T) { func TestNotificationPolicy(t *testing.T) {

View File

@ -8,10 +8,11 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"gopkg.in/yaml.v3"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/provisioning/utils" "github.com/grafana/grafana/pkg/services/provisioning/utils"
"gopkg.in/yaml.v3"
) )
type configReader struct { type configReader struct {

View File

@ -7,9 +7,10 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/log"
) )
var ( var (

View File

@ -5,9 +5,10 @@ import (
"os" "os"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/plugins"
"github.com/stretchr/testify/require"
) )
const ( const (

View File

@ -6,12 +6,13 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert"
dashboardstore "github.com/grafana/grafana/pkg/services/dashboards" dashboardstore "github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/provisioning/dashboards" "github.com/grafana/grafana/pkg/services/provisioning/dashboards"
"github.com/grafana/grafana/pkg/services/provisioning/utils" "github.com/grafana/grafana/pkg/services/provisioning/utils"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert"
) )
func TestProvisioningServiceImpl(t *testing.T) { func TestProvisioningServiceImpl(t *testing.T) {

View File

@ -6,11 +6,12 @@ import (
"os" "os"
"testing" "testing"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"github.com/grafana/grafana/pkg/setting"
) )
func TestValues(t *testing.T) { func TestValues(t *testing.T) {

View File

@ -5,6 +5,7 @@ import (
"strings" "strings"
"github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/services/contexthandler" "github.com/grafana/grafana/pkg/services/contexthandler"
"github.com/grafana/grafana/pkg/services/datasources" "github.com/grafana/grafana/pkg/services/datasources"

View File

@ -3,8 +3,9 @@ package queryhistory
import ( import (
"testing" "testing"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/components/simplejson"
) )
func TestIntegrationCreateQueryInQueryHistory(t *testing.T) { func TestIntegrationCreateQueryInQueryHistory(t *testing.T) {

View File

@ -5,8 +5,9 @@ import (
"testing" "testing"
"time" "time"
"github.com/grafana/grafana/pkg/web"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/web"
) )
func TestIntegrationDeleteStaleQueryFromQueryHistory(t *testing.T) { func TestIntegrationDeleteStaleQueryFromQueryHistory(t *testing.T) {

View File

@ -5,8 +5,9 @@ import (
"testing" "testing"
"time" "time"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/components/simplejson"
) )
func TestIntegrationMigrateQueriesToQueryHistory(t *testing.T) { func TestIntegrationMigrateQueriesToQueryHistory(t *testing.T) {

View File

@ -3,8 +3,9 @@ package queryhistory
import ( import (
"testing" "testing"
"github.com/grafana/grafana/pkg/web"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/web"
) )
func TestIntegrationPatchQueryCommentInQueryHistory(t *testing.T) { func TestIntegrationPatchQueryCommentInQueryHistory(t *testing.T) {

View File

@ -3,8 +3,9 @@ package queryhistory
import ( import (
"testing" "testing"
"github.com/grafana/grafana/pkg/web"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/web"
) )
func TestIntegrationStarQueryInQueryHistory(t *testing.T) { func TestIntegrationStarQueryInQueryHistory(t *testing.T) {

View File

@ -3,8 +3,9 @@ package queryhistory
import ( import (
"testing" "testing"
"github.com/grafana/grafana/pkg/web"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/web"
) )
func TestIntegrationUnstarQueryInQueryHistory(t *testing.T) { func TestIntegrationUnstarQueryInQueryHistory(t *testing.T) {

View File

@ -4,12 +4,13 @@ import (
"context" "context"
"sync" "sync"
"golang.org/x/sync/errgroup"
"github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model" contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/grafana/pkg/services/quota" "github.com/grafana/grafana/pkg/services/quota"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"golang.org/x/sync/errgroup"
) )
type serviceDisabled struct { type serviceDisabled struct {

View File

@ -9,6 +9,7 @@ import (
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
models "github.com/grafana/grafana/pkg/models" models "github.com/grafana/grafana/pkg/models"
) )

View File

@ -9,12 +9,13 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
func TestGetUrl(t *testing.T) { func TestGetUrl(t *testing.T) {

View File

@ -5,12 +5,11 @@ import (
"sort" "sort"
"github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/dashboards" "github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/star" "github.com/grafana/grafana/pkg/services/star"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/models"
) )
func ProvideService(cfg *setting.Cfg, sqlstore db.DB, starService star.Service, dashboardService dashboards.DashboardService) *SearchService { func ProvideService(cfg *setting.Cfg, sqlstore db.DB, starService star.Service, dashboardService dashboards.DashboardService) *SearchService {

View File

@ -4,9 +4,10 @@ import (
"context" "context"
"testing" "testing"
"github.com/grafana/grafana/pkg/plugins/backendplugin/secretsmanagerplugin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/plugins/backendplugin/secretsmanagerplugin"
) )
// Set fatal flag to true, then simulate a plugin start failure // Set fatal flag to true, then simulate a plugin start failure

View File

@ -3,6 +3,9 @@ package manager
import ( import (
"testing" "testing"
"github.com/stretchr/testify/require"
"gopkg.in/ini.v1"
"github.com/grafana/grafana/pkg/infra/usagestats" "github.com/grafana/grafana/pkg/infra/usagestats"
encryptionprovider "github.com/grafana/grafana/pkg/services/encryption/provider" encryptionprovider "github.com/grafana/grafana/pkg/services/encryption/provider"
encryptionservice "github.com/grafana/grafana/pkg/services/encryption/service" encryptionservice "github.com/grafana/grafana/pkg/services/encryption/service"
@ -10,8 +13,6 @@ import (
"github.com/grafana/grafana/pkg/services/kmsproviders/osskmsproviders" "github.com/grafana/grafana/pkg/services/kmsproviders/osskmsproviders"
"github.com/grafana/grafana/pkg/services/secrets" "github.com/grafana/grafana/pkg/services/secrets"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require"
"gopkg.in/ini.v1"
) )
func SetupTestService(tb testing.TB, store secrets.Store) *SecretsService { func SetupTestService(tb testing.TB, store secrets.Store) *SecretsService {

View File

@ -11,6 +11,9 @@ import (
"sync" "sync"
"time" "time"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/sync/errgroup"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/usagestats" "github.com/grafana/grafana/pkg/infra/usagestats"
"github.com/grafana/grafana/pkg/services/encryption" "github.com/grafana/grafana/pkg/services/encryption"
@ -19,9 +22,6 @@ import (
"github.com/grafana/grafana/pkg/services/secrets" "github.com/grafana/grafana/pkg/services/secrets"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util" "github.com/grafana/grafana/pkg/util"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/sync/errgroup"
) )
const ( const (

View File

@ -1,9 +1,10 @@
package manager package manager
import ( import (
"github.com/prometheus/client_golang/prometheus"
"github.com/grafana/grafana/pkg/infra/metrics" "github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/infra/metrics/metricutil" "github.com/grafana/grafana/pkg/infra/metrics/metricutil"
"github.com/prometheus/client_golang/prometheus"
) )
const ( const (

View File

@ -3,9 +3,9 @@ package sqlstore
import ( import (
"fmt" "fmt"
glog "github.com/grafana/grafana/pkg/infra/log"
"xorm.io/core" "xorm.io/core"
glog "github.com/grafana/grafana/pkg/infra/log"
) )
type XormLogger struct { type XormLogger struct {

View File

@ -4,10 +4,10 @@ import (
"fmt" "fmt"
"strings" "strings"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator" "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"xorm.io/xorm"
) )
const ActionMigrationID = "RBAC action name migrator" const ActionMigrationID = "RBAC action name migrator"

View File

@ -12,13 +12,14 @@ import (
"strings" "strings"
"time" "time"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator" "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"xorm.io/xorm"
) )
const ManagedPermissionsMigrationID = "managed permissions migration" const ManagedPermissionsMigrationID = "managed permissions migration"

View File

@ -6,6 +6,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"xorm.io/xorm" "xorm.io/xorm"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
@ -19,9 +21,6 @@ import (
"github.com/grafana/grafana/pkg/services/team" "github.com/grafana/grafana/pkg/services/team"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
type rawPermission struct { type rawPermission struct {

View File

@ -4,15 +4,15 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/dashboards"
acmig "github.com/grafana/grafana/pkg/services/sqlstore/migrations/accesscontrol" acmig "github.com/grafana/grafana/pkg/services/sqlstore/migrations/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator" "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require"
) )
func TestActionMigration(t *testing.T) { func TestActionMigration(t *testing.T) {

View File

@ -6,13 +6,14 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/stretchr/testify/require"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol"
acmig "github.com/grafana/grafana/pkg/services/sqlstore/migrations/accesscontrol" acmig "github.com/grafana/grafana/pkg/services/sqlstore/migrations/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator" "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require"
"xorm.io/xorm"
) )
type inheritanceTestCase struct { type inheritanceTestCase struct {

View File

@ -1,8 +1,9 @@
package migrations package migrations
import ( import (
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"xorm.io/xorm" "xorm.io/xorm"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
) )
func addAnnotationMig(mg *Migrator) { func addAnnotationMig(mg *Migrator) {

View File

@ -5,12 +5,13 @@ import (
"net/url" "net/url"
"time" "time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/services/datasources" "github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/sqlstore/migrations/ualert" "github.com/grafana/grafana/pkg/services/sqlstore/migrations/ualert"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator" "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/util" "github.com/grafana/grafana/pkg/util"
"xorm.io/xorm"
) )
func AddExternalAlertmanagerToDatasourceMigration(mg *migrator.Migrator) { func AddExternalAlertmanagerToDatasourceMigration(mg *migrator.Migrator) {

View File

@ -3,8 +3,9 @@ package migrations
import ( import (
"time" "time"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"xorm.io/xorm" "xorm.io/xorm"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
) )
func addTempUserMigrations(mg *Migrator) { func addTempUserMigrations(mg *Migrator) {

View File

@ -3,9 +3,10 @@ package migrations
import ( import (
"fmt" "fmt"
"xorm.io/xorm"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator" . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/util" "github.com/grafana/grafana/pkg/util"
"xorm.io/xorm"
) )
func addUserMigrations(mg *Migrator) { func addUserMigrations(mg *Migrator) {

View File

@ -9,7 +9,6 @@ import (
"github.com/golang-migrate/migrate/v4/database" "github.com/golang-migrate/migrate/v4/database"
"github.com/lib/pq" "github.com/lib/pq"
"xorm.io/xorm" "xorm.io/xorm"
) )

View File

@ -7,11 +7,10 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/mattn/go-sqlite3"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"xorm.io/xorm" "xorm.io/xorm"
"github.com/mattn/go-sqlite3"
"github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/tracing" "github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator" "github.com/grafana/grafana/pkg/services/sqlstore/migrator"

View File

@ -5,8 +5,9 @@ import (
"net/url" "net/url"
"testing" "testing"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/setting"
) )
type sqlStoreTest struct { type sqlStoreTest struct {

View File

@ -4,10 +4,10 @@ import (
"context" "context"
"testing" "testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/services/tag" "github.com/grafana/grafana/pkg/services/tag"
"github.com/stretchr/testify/require"
) )
type getStore func(db.DB) store type getStore func(db.DB) store

View File

@ -5,6 +5,9 @@ import (
"errors" "errors"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/localcache" "github.com/grafana/grafana/pkg/infra/localcache"
"github.com/grafana/grafana/pkg/models/roletype" "github.com/grafana/grafana/pkg/models/roletype"
"github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/org"
@ -12,9 +15,6 @@ import (
"github.com/grafana/grafana/pkg/services/team/teamtest" "github.com/grafana/grafana/pkg/services/team/teamtest"
"github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
func TestUserService(t *testing.T) { func TestUserService(t *testing.T) {