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
+1 -1
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/monitoring/prometheus v1.2.0
github.com/go-micro/plugins/v4/wrapper/trace/opentelemetry 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/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-jwt/jwt/v5 v5.3.0
github.com/golang/protobuf v1.5.4 github.com/golang/protobuf v1.5.4
github.com/google/go-cmp v0.7.0 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-json v0.10.5 // indirect
github.com/goccy/go-yaml v1.18.0 // indirect github.com/goccy/go-yaml v1.18.0 // indirect
github.com/gofrs/flock v0.13.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/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
+6 -6
View File
@@ -5,7 +5,7 @@ import (
"os" "os"
"path" "path"
"github.com/gofrs/uuid" "github.com/google/uuid"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/opencloud-eu/opencloud/pkg/generators" "github.com/opencloud-eu/opencloud/pkg/generators"
@@ -103,11 +103,11 @@ func CreateConfig(insecure, forceOverwrite, diff bool, configPath, adminPassword
} }
} }
} else { } else {
systemUserID = uuid.Must(uuid.NewV4()).String() systemUserID = uuid.NewString()
adminUserID = uuid.Must(uuid.NewV4()).String() adminUserID = uuid.NewString()
graphApplicationID = uuid.Must(uuid.NewV4()).String() graphApplicationID = uuid.NewString()
storageUsersMountID = uuid.Must(uuid.NewV4()).String() storageUsersMountID = uuid.NewString()
serviceAccountID = uuid.Must(uuid.NewV4()).String() serviceAccountID = uuid.NewString()
idmServicePassword, err = generators.GenerateRandomPassword(passwordLength) idmServicePassword, err = generators.GenerateRandomPassword(passwordLength)
if err != nil { if err != nil {
@@ -7,7 +7,7 @@ import (
"time" "time"
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
"github.com/gofrs/uuid" "github.com/google/uuid"
libregraph "github.com/opencloud-eu/libre-graph-api-go" libregraph "github.com/opencloud-eu/libre-graph-api-go"
"github.com/opencloud-eu/opencloud/pkg/log" "github.com/opencloud-eu/opencloud/pkg/log"
"github.com/opencloud-eu/opencloud/services/graph/pkg/config" "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()}) ar.Attribute(i.educationConfig.schoolAttributeMap.schoolNumber, []string{school.GetSchoolNumber()})
} }
if !i.useServerUUID { 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"} objectClasses := []string{"organizationalUnit", i.educationConfig.schoolObjectClass, "top"}
ar.Attribute("objectClass", objectClasses) ar.Attribute("objectClass", objectClasses)
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"github.com/CiscoM31/godata" "github.com/CiscoM31/godata"
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
"github.com/gofrs/uuid" "github.com/google/uuid"
"github.com/libregraph/idm/pkg/ldapdn" "github.com/libregraph/idm/pkg/ldapdn"
libregraph "github.com/opencloud-eu/libre-graph-api-go" 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 { if !i.useServerUUID {
attrs["openCloudUUID"] = []string{uuid.Must(uuid.NewV4()).String()} attrs["openCloudUUID"] = []string{uuid.NewString()}
attrs["objectClass"] = append(attrs["objectClass"], "openCloudObject") attrs["objectClass"] = append(attrs["objectClass"], "openCloudObject")
} }
return attrs, nil return attrs, nil
@@ -6,7 +6,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/gofrs/uuid" "github.com/google/uuid"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0" 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/settings"
"github.com/opencloud-eu/opencloud/services/settings/pkg/store/defaults" "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 { if accountUUID == serviceAccountID {
return []*settingsmsg.UserRoleAssignment{ 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, AccountUuid: accountUUID,
RoleId: defaults.BundleUUIDServiceAccount, RoleId: defaults.BundleUUIDServiceAccount,
}, },
@@ -136,7 +136,7 @@ func (s *Store) WriteRoleAssignment(accountUUID, roleID string) (*settingsmsg.Us
} }
ass := &settingsmsg.UserRoleAssignment{ ass := &settingsmsg.UserRoleAssignment{
Id: uuid.Must(uuid.NewV4()).String(), Id: uuid.NewString(),
AccountUuid: accountUUID, AccountUuid: accountUUID,
RoleId: roleID, RoleId: roleID,
} }
@@ -5,7 +5,7 @@ import (
"sync" "sync"
"testing" "testing"
"github.com/gofrs/uuid" "github.com/google/uuid"
olog "github.com/opencloud-eu/opencloud/pkg/log" olog "github.com/opencloud-eu/opencloud/pkg/log"
"github.com/opencloud-eu/opencloud/pkg/shared" "github.com/opencloud-eu/opencloud/pkg/shared"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0" settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
@@ -95,7 +95,7 @@ func initStore() *Store {
cfg: defaults.DefaultConfig(), cfg: defaults.DefaultConfig(),
} }
s.cfg.Commons = &shared.Commons{ s.cfg.Commons = &shared.Commons{
AdminUserID: uuid.Must(uuid.NewV4()).String(), AdminUserID: uuid.NewString(),
} }
_ = NewMDC(s) _ = NewMDC(s)
@@ -7,7 +7,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/gofrs/uuid" "github.com/google/uuid"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0" 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/settings"
"github.com/opencloud-eu/opencloud/services/settings/pkg/store/defaults" "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 == "" { if setting.Id == "" {
setting.Id = uuid.Must(uuid.NewV4()).String() setting.Id = uuid.NewString()
} }
b.Settings = append(b.Settings, setting) b.Settings = append(b.Settings, setting)
@@ -3,7 +3,7 @@ package store
import ( import (
"testing" "testing"
"github.com/gofrs/uuid" "github.com/google/uuid"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0" settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@@ -102,7 +102,7 @@ var bundleScenarios = []struct {
} }
var ( var (
appendTestBundleID = uuid.Must(uuid.NewV4()).String() appendTestBundleID = uuid.NewString()
appendTestSetting1 = &settingsmsg.Setting{ appendTestSetting1 = &settingsmsg.Setting{
Id: "append-test-setting-1", Id: "append-test-setting-1",
@@ -7,7 +7,7 @@ import (
"log" "log"
"sync" "sync"
"github.com/gofrs/uuid" "github.com/google/uuid"
olog "github.com/opencloud-eu/opencloud/pkg/log" olog "github.com/opencloud-eu/opencloud/pkg/log"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0" settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0"
"github.com/opencloud-eu/opencloud/services/settings/pkg/config" "github.com/opencloud-eu/opencloud/services/settings/pkg/config"
@@ -21,7 +21,7 @@ var (
// Name is the default name for the settings store // Name is the default name for the settings store
Name = "opencloud-settings" Name = "opencloud-settings"
managerName = "metadata" managerName = "metadata"
settingsSpaceID = "f1bdd61a-da7c-49fc-8203-0558109d1b4f" // uuid.Must(uuid.NewV4()).String() settingsSpaceID = "f1bdd61a-da7c-49fc-8203-0558109d1b4f" // uuid.NewString()
rootFolderLocation = "settings" rootFolderLocation = "settings"
bundleFolderLocation = "settings/bundles" bundleFolderLocation = "settings/bundles"
accountsFolderLocation = "settings/accounts" accountsFolderLocation = "settings/accounts"
@@ -156,7 +156,7 @@ func (s *Store) initMetadataClient(mdc MetadataClient) error {
} }
ass := &settingsmsg.UserRoleAssignment{ ass := &settingsmsg.UserRoleAssignment{
Id: uuid.Must(uuid.NewV4()).String(), Id: uuid.NewString(),
AccountUuid: accountUUID, AccountUuid: accountUUID,
RoleId: roleID, RoleId: roleID,
} }
@@ -220,7 +220,7 @@ func (s *Store) userMustHaveAdminRole(accountUUID string, assIDs []string, mdc M
} }
ass := &settingsmsg.UserRoleAssignment{ ass := &settingsmsg.UserRoleAssignment{
Id: uuid.Must(uuid.NewV4()).String(), Id: uuid.NewString(),
AccountUuid: accountUUID, AccountUuid: accountUUID,
RoleId: defaults.BundleUUIDRoleAdmin, RoleId: defaults.BundleUUIDRoleAdmin,
} }
@@ -6,7 +6,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/gofrs/uuid" "github.com/google/uuid"
settingsmsg "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/messages/settings/v0" 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/settings"
"github.com/opencloud-eu/reva/v2/pkg/errtypes" "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() ctx := context.TODO()
if value.Id == "" { if value.Id == "" {
value.Id = uuid.Must(uuid.NewV4()).String() value.Id = uuid.NewString()
} }
b, err := json.Marshal(value) b, err := json.Marshal(value)
if err != nil { if err != nil {