Chore: Replace xorm.io/xorm imports (#104458)

* replace xorm.io/xorm imports

* replace xorm from other go.mod files

* clean up workspace

* nolint does not make sense anymore as it is not a module

* try if nolint directive helps

* use nolint:all for xorm

* add more nolints

* try to skip xorm in linter config

* exclude xorm differently

* retrigger ci
This commit is contained in:
Serge Zaitsev
2025-05-02 17:13:01 +02:00
committed by GitHub
parent 847b07dee2
commit 694b9dfe50
65 changed files with 58 additions and 1780 deletions
-3
View File
@@ -133,6 +133,3 @@ replace github.com/crewjam/saml => github.com/grafana/saml v0.4.15-0.20240523142
replace github.com/prometheus/alertmanager => github.com/grafana/prometheus-alertmanager v0.25.1-0.20240625192351-66ec17e3aa45
exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible
// Use our fork xorm. go.work currently overrides this and points to the local ./pkg/util/xorm directory.
replace xorm.io/xorm => github.com/grafana/grafana/pkg/util/xorm v0.0.1
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/grafana/grafana/pkg/util/xorm/core"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
+1 -1
View File
@@ -3,8 +3,8 @@ package dbtest
import (
"context"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/util/xorm/core"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/services/accesscontrol"
@@ -6,7 +6,7 @@ import (
"fmt"
"strings"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/setting"
@@ -2,7 +2,7 @@ package migrations
import (
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
type DummyMigration struct {
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"strings"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/events"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/apimachinery/identity"
"github.com/grafana/grafana/pkg/infra/db"
@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -5,7 +5,7 @@ import (
"strings"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -3,7 +3,7 @@ package accesscontrol
import (
"strings"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -4,7 +4,7 @@ import (
"fmt"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -6,7 +6,7 @@ import (
"strings"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/dashboards"
@@ -3,7 +3,7 @@ package accesscontrol
import (
"fmt"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -3,7 +3,7 @@ package accesscontrol
import (
"fmt"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -12,9 +12,9 @@ import (
"strings"
"time"
"github.com/grafana/grafana/pkg/util/xorm"
"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/services/accesscontrol"
@@ -5,7 +5,7 @@ import (
"strconv"
"strings"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -6,7 +6,7 @@ import (
"strings"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -1,7 +1,7 @@
package accesscontrol
import (
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -1,7 +1,7 @@
package accesscontrol
import (
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -5,7 +5,7 @@ import (
"strconv"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/org"
@@ -10,9 +10,9 @@ import (
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/stretchr/testify/require"
"gopkg.in/ini.v1"
"xorm.io/xorm"
)
type rawPermission struct {
@@ -5,8 +5,8 @@ import (
"strings"
"testing"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/stretchr/testify/require"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/accesscontrol"
@@ -1,7 +1,7 @@
package migrations
import (
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -3,7 +3,7 @@ package migrations
import (
"fmt"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -6,7 +6,7 @@ import (
"os"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/infra/log"
@@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
"gopkg.in/ini.v1"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"fmt"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
// does not rely on dashboard table existing, can be run before dashboard migrations
@@ -3,7 +3,7 @@ package migrations
import (
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -10,7 +10,7 @@ import (
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/util"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
// AddAlertRuleGuidMigration sets up migrations for adding and managing GUID columns in alert_rule and alert_rule_version tables.
@@ -5,7 +5,7 @@ import (
"fmt"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -5,7 +5,7 @@ import (
"strconv"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -4,7 +4,7 @@ import (
"fmt"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -1,7 +1,7 @@
package ualert
import (
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -5,7 +5,7 @@ import (
"fmt"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -3,7 +3,7 @@ package ualert
import (
"fmt"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
@@ -3,9 +3,9 @@ package test
import (
"testing"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/stretchr/testify/require"
"gopkg.in/ini.v1"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
@@ -6,7 +6,7 @@ import (
"path/filepath"
"strconv"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
+1 -1
View File
@@ -3,7 +3,7 @@ package migrations
import (
"fmt"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrations/usermig"
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
const (
@@ -4,9 +4,9 @@ import (
"testing"
"time"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/stretchr/testify/require"
"gopkg.in/ini.v1"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
@@ -5,7 +5,7 @@ import (
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/services/user"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
const (
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"golang.org/x/exp/slices"
"github.com/grafana/grafana/pkg/services/sqlstore/session"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
var (
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"go.opentelemetry.io/otel/trace"
"go.uber.org/atomic"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/metrics/metricutil"
@@ -10,7 +10,7 @@ import (
"github.com/VividCortex/mysqlerr"
"github.com/go-sql-driver/mysql"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
type MySQLDialect struct {
@@ -9,7 +9,7 @@ import (
"github.com/lib/pq"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
type PostgresDialect struct {
@@ -16,8 +16,8 @@ import (
"cloud.google.com/go/spanner/admin/database/apiv1/databasepb"
"github.com/googleapis/gax-go/v2"
spannerdriver "github.com/googleapis/go-sql-spanner"
"github.com/grafana/grafana/pkg/util/xorm"
"google.golang.org/grpc/codes"
"xorm.io/xorm"
"github.com/grafana/dskit/concurrency"
utilspanner "github.com/grafana/grafana/pkg/util/spanner"
@@ -7,7 +7,7 @@ import (
"github.com/mattn/go-sqlite3"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
type SQLite3 struct {
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
const (
+1 -1
View File
@@ -10,8 +10,8 @@ import (
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/noop"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/util/xorm/core"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/apimachinery/errutil"
"github.com/grafana/grafana/pkg/infra/log"
+1 -1
View File
@@ -16,8 +16,8 @@ import (
_ "github.com/lib/pq"
"github.com/prometheus/client_golang/prometheus"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/util/xorm/core"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/infra/fs"
+1 -1
View File
@@ -27,7 +27,7 @@ import (
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
"github.com/grafana/grafana/pkg/setting"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
// TestingTB is an interface that is implemented by *testing.T and *testing.B. Similar to testing.TB.
@@ -12,7 +12,7 @@ import (
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
)
// Ensure that we can get any connection at all.
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"time"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/infra/log"
@@ -9,7 +9,7 @@ import (
"github.com/go-sql-driver/mysql"
"github.com/grafana/dskit/crypto/tls"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
+1 -1
View File
@@ -7,10 +7,10 @@ import (
"sync"
"github.com/dlmiddlecote/sqlstats"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/prometheus/client_golang/prometheus"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/noop"
"xorm.io/xorm"
infraDB "github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/log"
@@ -3,9 +3,9 @@ package migrations
import (
"fmt"
"github.com/grafana/grafana/pkg/util/xorm"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"xorm.io/builder"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/apimachinery/utils"
"github.com/grafana/grafana/pkg/infra/log"
@@ -3,7 +3,7 @@ package migrations
import (
"context"
"xorm.io/xorm"
"github.com/grafana/grafana/pkg/util/xorm"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/setting"
View File
-64
View File
@@ -1,64 +0,0 @@
module github.com/grafana/grafana/pkg/util/xorm
go 1.24.2
require (
cloud.google.com/go/spanner v1.75.0
github.com/googleapis/go-sql-spanner v1.11.1
github.com/mattn/go-sqlite3 v1.14.22
github.com/stretchr/testify v1.10.0
google.golang.org/grpc v1.71.1
xorm.io/builder v0.3.6
)
require (
cel.dev/expr v0.19.1 // indirect
cloud.google.com/go v0.118.2 // indirect
cloud.google.com/go/auth v0.15.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.7 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/iam v1.3.1 // indirect
cloud.google.com/go/longrunning v0.6.4 // indirect
cloud.google.com/go/monitoring v1.23.0 // indirect
github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.2 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.34.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/oauth2 v0.29.0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/time v0.11.0 // indirect
google.golang.org/api v0.223.0 // indirect
google.golang.org/genproto v0.0.0-20250122153221-138b5a5a4fd4 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
-1641
View File
File diff suppressed because it is too large Load Diff