mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
281ed419a8
commit
a14ca8fb62
2
go.mod
2
go.mod
@ -41,7 +41,7 @@ require (
|
||||
github.com/go-sql-driver/mysql v1.6.0
|
||||
github.com/go-stack/stack v1.8.0
|
||||
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/golang/mock v1.6.0
|
||||
github.com/golang/snappy v0.0.4
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/google/uuid"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -60,7 +60,7 @@ func TestAPIGetPublicDashboard(t *testing.T) {
|
||||
})
|
||||
|
||||
DashboardUid := "dashboard-abcd1234"
|
||||
token, err := uuid.NewV4()
|
||||
token, err := uuid.NewRandom()
|
||||
require.NoError(t, err)
|
||||
accessToken := fmt.Sprintf("%x", token)
|
||||
|
||||
|
@ -8,6 +8,8 @@ import (
|
||||
_ "github.com/Azure/go-autorest/autorest"
|
||||
_ "github.com/Azure/go-autorest/autorest/adal"
|
||||
_ "github.com/beevik/etree"
|
||||
_ "github.com/blugelabs/bluge"
|
||||
_ "github.com/blugelabs/bluge_segment_api"
|
||||
_ "github.com/cortexproject/cortex/pkg/util"
|
||||
_ "github.com/crewjam/saml"
|
||||
_ "github.com/gobwas/glob"
|
||||
|
@ -5,8 +5,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/grafana/grafana/pkg/api/dtos"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"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
|
||||
func GenerateAccessToken() (string, error) {
|
||||
token, err := uuid.NewV4()
|
||||
token, err := uuid.NewRandom()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%x", token), nil
|
||||
return fmt.Sprintf("%x", token[:]), nil
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -153,8 +153,8 @@ func TestSavePublicDashboard(t *testing.T) {
|
||||
// Time settings set by db
|
||||
assert.Equal(t, timeSettings, pubdash.TimeSettings)
|
||||
// accessToken is valid uuid
|
||||
_, err = uuid.FromString(pubdash.AccessToken)
|
||||
require.NoError(t, err)
|
||||
_, err = uuid.Parse(pubdash.AccessToken)
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user