chore: drop gofrs/uuid module usage and use google/uuid

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
This commit is contained in:
Mikel Olasagasti Uranga
2025-11-12 11:47:13 +01:00
committed by Ralf Haferkamp
parent c76ba6f8c3
commit 06b78b8261
10 changed files with 26 additions and 26 deletions
@@ -6,7 +6,7 @@ import (
"encoding/json"
"fmt"
"github.com/gofrs/uuid"
"github.com/google/uuid"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
"github.com/opencloud-eu/opencloud/services/settings/pkg/settings"
"github.com/opencloud-eu/opencloud/services/settings/pkg/store/defaults"
@@ -20,7 +20,7 @@ func (s *Store) ListRoleAssignments(accountUUID string) ([]*settingsmsg.UserRole
if accountUUID == serviceAccountID {
return []*settingsmsg.UserRoleAssignment{
{
Id: uuid.Must(uuid.NewV4()).String(), // should we hardcode this id too?
Id: uuid.NewString(), // should we hardcode this id too?
AccountUuid: accountUUID,
RoleId: defaults.BundleUUIDServiceAccount,
},
@@ -136,7 +136,7 @@ func (s *Store) WriteRoleAssignment(accountUUID, roleID string) (*settingsmsg.Us
}
ass := &settingsmsg.UserRoleAssignment{
Id: uuid.Must(uuid.NewV4()).String(),
Id: uuid.NewString(),
AccountUuid: accountUUID,
RoleId: roleID,
}
@@ -5,7 +5,7 @@ import (
"sync"
"testing"
"github.com/gofrs/uuid"
"github.com/google/uuid"
olog "github.com/opencloud-eu/opencloud/pkg/log"
"github.com/opencloud-eu/opencloud/pkg/shared"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
@@ -95,7 +95,7 @@ func initStore() *Store {
cfg: defaults.DefaultConfig(),
}
s.cfg.Commons = &shared.Commons{
AdminUserID: uuid.Must(uuid.NewV4()).String(),
AdminUserID: uuid.NewString(),
}
_ = NewMDC(s)
@@ -7,7 +7,7 @@ import (
"errors"
"fmt"
"github.com/gofrs/uuid"
"github.com/google/uuid"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
"github.com/opencloud-eu/opencloud/services/settings/pkg/settings"
"github.com/opencloud-eu/opencloud/services/settings/pkg/store/defaults"
@@ -146,7 +146,7 @@ func (s *Store) AddSettingToBundle(bundleID string, setting *settingsmsg.Setting
}
if setting.Id == "" {
setting.Id = uuid.Must(uuid.NewV4()).String()
setting.Id = uuid.NewString()
}
b.Settings = append(b.Settings, setting)
@@ -3,7 +3,7 @@ package store
import (
"testing"
"github.com/gofrs/uuid"
"github.com/google/uuid"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
"github.com/stretchr/testify/require"
)
@@ -102,7 +102,7 @@ var bundleScenarios = []struct {
}
var (
appendTestBundleID = uuid.Must(uuid.NewV4()).String()
appendTestBundleID = uuid.NewString()
appendTestSetting1 = &settingsmsg.Setting{
Id: "append-test-setting-1",
@@ -7,7 +7,7 @@ import (
"log"
"sync"
"github.com/gofrs/uuid"
"github.com/google/uuid"
olog "github.com/opencloud-eu/opencloud/pkg/log"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
"github.com/opencloud-eu/opencloud/services/settings/pkg/config"
@@ -21,7 +21,7 @@ var (
// Name is the default name for the settings store
Name = "opencloud-settings"
managerName = "metadata"
settingsSpaceID = "f1bdd61a-da7c-49fc-8203-0558109d1b4f" // uuid.Must(uuid.NewV4()).String()
settingsSpaceID = "f1bdd61a-da7c-49fc-8203-0558109d1b4f" // uuid.NewString()
rootFolderLocation = "settings"
bundleFolderLocation = "settings/bundles"
accountsFolderLocation = "settings/accounts"
@@ -156,7 +156,7 @@ func (s *Store) initMetadataClient(mdc MetadataClient) error {
}
ass := &settingsmsg.UserRoleAssignment{
Id: uuid.Must(uuid.NewV4()).String(),
Id: uuid.NewString(),
AccountUuid: accountUUID,
RoleId: roleID,
}
@@ -220,7 +220,7 @@ func (s *Store) userMustHaveAdminRole(accountUUID string, assIDs []string, mdc M
}
ass := &settingsmsg.UserRoleAssignment{
Id: uuid.Must(uuid.NewV4()).String(),
Id: uuid.NewString(),
AccountUuid: accountUUID,
RoleId: defaults.BundleUUIDRoleAdmin,
}
@@ -6,7 +6,7 @@ import (
"encoding/json"
"fmt"
"github.com/gofrs/uuid"
"github.com/google/uuid"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
"github.com/opencloud-eu/opencloud/services/settings/pkg/settings"
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
@@ -127,7 +127,7 @@ func (s *Store) WriteValue(value *settingsmsg.Value) (*settingsmsg.Value, error)
ctx := context.TODO()
if value.Id == "" {
value.Id = uuid.Must(uuid.NewV4()).String()
value.Id = uuid.NewString()
}
b, err := json.Marshal(value)
if err != nil {