Dependencies: Clean up gofrs/uuid (#51615)

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

Co-authored-by: Jeff Levin <jeff@levinology.com>
pull/51654/head^2
Emil Tullstedt 3 years ago committed by GitHub
parent 281ed419a8
commit a14ca8fb62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      go.mod
  2. 4
      pkg/api/dashboard_public_test.go
  3. 2
      pkg/extensions/main.go
  4. 7
      pkg/services/dashboards/service/dashboard_public.go
  5. 6
      pkg/services/dashboards/service/dashboard_public_test.go

@ -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…
Cancel
Save