Dependencies: Clean up gofrs/uuid (#51615)

* Dependencies: switch from gofrs/uuid to google/uuid

Co-authored-by: Jeff Levin <jeff@levinology.com>
This commit is contained in:
Emil Tullstedt 2022-06-30 20:55:33 +02:00 committed by GitHub
parent 281ed419a8
commit a14ca8fb62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 10 deletions

2
go.mod
View File

@ -41,7 +41,7 @@ require (
github.com/go-sql-driver/mysql v1.6.0 github.com/go-sql-driver/mysql v1.6.0
github.com/go-stack/stack v1.8.0 github.com/go-stack/stack v1.8.0
github.com/gobwas/glob v0.2.3 github.com/gobwas/glob v0.2.3
github.com/gofrs/uuid v4.0.0+incompatible github.com/gofrs/uuid v4.0.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0 github.com/golang/mock v1.6.0
github.com/golang/snappy v0.0.4 github.com/golang/snappy v0.0.4

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/gofrs/uuid" "github.com/google/uuid"
"github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data" "github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -60,7 +60,7 @@ func TestAPIGetPublicDashboard(t *testing.T) {
}) })
DashboardUid := "dashboard-abcd1234" DashboardUid := "dashboard-abcd1234"
token, err := uuid.NewV4() token, err := uuid.NewRandom()
require.NoError(t, err) require.NoError(t, err)
accessToken := fmt.Sprintf("%x", token) accessToken := fmt.Sprintf("%x", token)

View File

@ -8,6 +8,8 @@ import (
_ "github.com/Azure/go-autorest/autorest" _ "github.com/Azure/go-autorest/autorest"
_ "github.com/Azure/go-autorest/autorest/adal" _ "github.com/Azure/go-autorest/autorest/adal"
_ "github.com/beevik/etree" _ "github.com/beevik/etree"
_ "github.com/blugelabs/bluge"
_ "github.com/blugelabs/bluge_segment_api"
_ "github.com/cortexproject/cortex/pkg/util" _ "github.com/cortexproject/cortex/pkg/util"
_ "github.com/crewjam/saml" _ "github.com/crewjam/saml"
_ "github.com/gobwas/glob" _ "github.com/gobwas/glob"

View File

@ -5,8 +5,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/gofrs/uuid" "github.com/google/uuid"
"github.com/grafana/grafana/pkg/api/dtos" "github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/models"
@ -146,10 +145,10 @@ func (dr *DashboardServiceImpl) BuildPublicDashboardMetricRequest(ctx context.Co
// generates a uuid formatted without dashes to use as access token // generates a uuid formatted without dashes to use as access token
func GenerateAccessToken() (string, error) { func GenerateAccessToken() (string, error) {
token, err := uuid.NewV4() token, err := uuid.NewRandom()
if err != nil { if err != nil {
return "", err return "", err
} }
return fmt.Sprintf("%x", token), nil return fmt.Sprintf("%x", token[:]), nil
} }

View File

@ -5,7 +5,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/gofrs/uuid" "github.com/google/uuid"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -153,8 +153,8 @@ func TestSavePublicDashboard(t *testing.T) {
// Time settings set by db // Time settings set by db
assert.Equal(t, timeSettings, pubdash.TimeSettings) assert.Equal(t, timeSettings, pubdash.TimeSettings)
// accessToken is valid uuid // accessToken is valid uuid
_, err = uuid.FromString(pubdash.AccessToken) _, err = uuid.Parse(pubdash.AccessToken)
require.NoError(t, err) require.NoError(t, err, "expected a valid UUID, got %s", pubdash.AccessToken)
}) })
t.Run("Validate pubdash has default time setting value", func(t *testing.T) { t.Run("Validate pubdash has default time setting value", func(t *testing.T) {