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-11 23:12:10 +01:00
committed by Ralf Haferkamp
parent c76ba6f8c3
commit 06b78b8261
10 changed files with 26 additions and 26 deletions

2
go.mod
View File

@@ -34,7 +34,6 @@ require (
github.com/go-micro/plugins/v4/wrapper/monitoring/prometheus v1.2.0
github.com/go-micro/plugins/v4/wrapper/trace/opentelemetry v1.2.0
github.com/go-playground/validator/v10 v10.28.0
github.com/gofrs/uuid v4.4.0+incompatible
github.com/golang-jwt/jwt/v5 v5.3.0
github.com/golang/protobuf v1.5.4
github.com/google/go-cmp v0.7.0
@@ -230,6 +229,7 @@ require (
github.com/goccy/go-json v0.10.5 // indirect
github.com/goccy/go-yaml v1.18.0 // indirect
github.com/gofrs/flock v0.13.0 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect

View File

@@ -5,7 +5,7 @@ import (
"os"
"path"
"github.com/gofrs/uuid"
"github.com/google/uuid"
"gopkg.in/yaml.v2"
"github.com/opencloud-eu/opencloud/pkg/generators"
@@ -103,11 +103,11 @@ func CreateConfig(insecure, forceOverwrite, diff bool, configPath, adminPassword
}
}
} else {
systemUserID = uuid.Must(uuid.NewV4()).String()
adminUserID = uuid.Must(uuid.NewV4()).String()
graphApplicationID = uuid.Must(uuid.NewV4()).String()
storageUsersMountID = uuid.Must(uuid.NewV4()).String()
serviceAccountID = uuid.Must(uuid.NewV4()).String()
systemUserID = uuid.NewString()
adminUserID = uuid.NewString()
graphApplicationID = uuid.NewString()
storageUsersMountID = uuid.NewString()
serviceAccountID = uuid.NewString()
idmServicePassword, err = generators.GenerateRandomPassword(passwordLength)
if err != nil {

View File

@@ -7,7 +7,7 @@ import (
"time"
"github.com/go-ldap/ldap/v3"
"github.com/gofrs/uuid"
"github.com/google/uuid"
libregraph "github.com/opencloud-eu/libre-graph-api-go"
"github.com/opencloud-eu/opencloud/pkg/log"
"github.com/opencloud-eu/opencloud/services/graph/pkg/config"
@@ -148,7 +148,7 @@ func (i *LDAP) CreateEducationSchool(ctx context.Context, school libregraph.Educ
ar.Attribute(i.educationConfig.schoolAttributeMap.schoolNumber, []string{school.GetSchoolNumber()})
}
if !i.useServerUUID {
ar.Attribute(i.educationConfig.schoolAttributeMap.id, []string{uuid.Must(uuid.NewV4()).String()})
ar.Attribute(i.educationConfig.schoolAttributeMap.id, []string{uuid.NewString()})
}
objectClasses := []string{"organizationalUnit", i.educationConfig.schoolObjectClass, "top"}
ar.Attribute("objectClass", objectClasses)

View File

@@ -10,7 +10,7 @@ import (
"github.com/CiscoM31/godata"
"github.com/go-ldap/ldap/v3"
"github.com/gofrs/uuid"
"github.com/google/uuid"
"github.com/libregraph/idm/pkg/ldapdn"
libregraph "github.com/opencloud-eu/libre-graph-api-go"
@@ -448,7 +448,7 @@ func (i *LDAP) groupToLDAPAttrValues(group libregraph.Group) (map[string][]strin
}
if !i.useServerUUID {
attrs["openCloudUUID"] = []string{uuid.Must(uuid.NewV4()).String()}
attrs["openCloudUUID"] = []string{uuid.NewString()}
attrs["objectClass"] = append(attrs["objectClass"], "openCloudObject")
}
return attrs, nil

View File

@@ -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,
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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",

View File

@@ -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,
}

View File

@@ -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 {