Switch to google/uuid from satori/go.uuid (#2852)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
asv2 "k8s.io/api/autoscaling/v2"
|
||||
apiv1 "k8s.io/api/core/v1"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
@@ -37,6 +36,7 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -217,11 +217,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
}
|
||||
|
||||
buildcmd := input.String(flagkey.PkgBuildCmd)
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error generating uuid")
|
||||
}
|
||||
pkgName := generatePackageName(fnName, id.String())
|
||||
pkgName := generatePackageName(fnName, uuid.NewString())
|
||||
|
||||
// create new package in the same namespace as the function.
|
||||
pkgMetadata, err = _package.CreatePackage(input, opts.Client(), pkgName, fnNamespace, envName,
|
||||
@@ -401,11 +397,7 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
|
||||
}
|
||||
}
|
||||
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error generating UUID")
|
||||
}
|
||||
triggerName := id.String()
|
||||
triggerName := uuid.NewString()
|
||||
ht := &fv1.HTTPTrigger{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: triggerName,
|
||||
|
||||
@@ -3,7 +3,7 @@ package function
|
||||
import (
|
||||
"testing"
|
||||
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
func TestGeneratePackageName(t *testing.T) {
|
||||
@@ -29,11 +29,7 @@ func TestGeneratePackageName(t *testing.T) {
|
||||
},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
pkgName := generatePackageName(test.fnName, id.String())
|
||||
pkgName := generatePackageName(test.fnName, uuid.NewString())
|
||||
if len(pkgName) > test.expected {
|
||||
t.Errorf("expected len of package to be %v, got %v", test.expected, len(pkgName))
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -34,6 +33,7 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
type CreateSubCommand struct {
|
||||
@@ -70,11 +70,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
// just name triggers by uuid.
|
||||
if len(triggerName) == 0 {
|
||||
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.HtName))
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
triggerName = id.String()
|
||||
triggerName = uuid.NewString()
|
||||
}
|
||||
|
||||
userProvidedNS, fnNamespace, err := opts.GetResourceNamespace(input, flagkey.NamespaceFunction)
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -30,6 +29,7 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
type CreateSubCommand struct {
|
||||
@@ -53,11 +53,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
watchName := input.String(flagkey.KwName)
|
||||
if len(watchName) == 0 {
|
||||
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.MqtName))
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error generating uuid")
|
||||
}
|
||||
watchName = id.String()
|
||||
watchName = uuid.NewString()
|
||||
}
|
||||
fnName := input.String(flagkey.KwFnName)
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -31,6 +30,7 @@ import (
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/mqtrigger/validator"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
type CreateSubCommand struct {
|
||||
@@ -54,11 +54,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
mqtName := input.String(flagkey.MqtName)
|
||||
if len(mqtName) == 0 {
|
||||
console.Warn(fmt.Sprintf("--%v will be soon marked as required flag, see 'help' for details", flagkey.MqtName))
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mqtName = id.String()
|
||||
mqtName = uuid.NewString()
|
||||
}
|
||||
fnName := input.String(flagkey.MqtFnName)
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -34,6 +33,7 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
type CreateSubCommand struct {
|
||||
@@ -179,11 +179,7 @@ func CreatePackage(input cli.Input, client cmd.Client, pkgName string, pkgNamesp
|
||||
}
|
||||
|
||||
if len(pkgName) == 0 {
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error generating UUID")
|
||||
}
|
||||
pkgName = strings.ToLower(id.String())
|
||||
pkgName = strings.ToLower(uuid.NewString())
|
||||
}
|
||||
|
||||
pkg := &fv1.Package{
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
"github.com/dchest/uniuri"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -40,6 +39,7 @@ import (
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/utils"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
// CreateArchive returns a fv1.Archive made from an archive . If specFile, then
|
||||
@@ -124,11 +124,7 @@ func CreateArchive(client cmd.Client, input cli.Input, includeFiles []string, no
|
||||
return nil, err
|
||||
}
|
||||
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
file := filepath.Join(tmpDir, id.String())
|
||||
file := filepath.Join(tmpDir, uuid.NewString())
|
||||
err = utils.DownloadUrl(input.Context(), http.DefaultClient, fileURL, file)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error downloading file from the given URL")
|
||||
|
||||
@@ -27,13 +27,13 @@ import (
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
storageSvcClient "github.com/fission/fission/pkg/storagesvc/client"
|
||||
"github.com/fission/fission/pkg/utils"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
func UploadArchiveFile(ctx context.Context, client cmd.Client, fileName string) (*fv1.Archive, error) {
|
||||
@@ -141,11 +141,7 @@ func DownloadToTempFile(fileUrl string) (string, error) {
|
||||
return "", errors.Wrapf(err, "error creating temp directory %v", tmpDir)
|
||||
}
|
||||
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "error generating UUID")
|
||||
}
|
||||
tmpFilename := id.String()
|
||||
tmpFilename := uuid.NewString()
|
||||
destination := filepath.Join(tmpDir, tmpFilename)
|
||||
|
||||
err = WriteArchiveToFile(destination, reader)
|
||||
@@ -209,11 +205,8 @@ func WriteArchiveToFile(fileName string, reader io.Reader) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tmpFileName := id.String()
|
||||
|
||||
tmpFileName := uuid.NewString()
|
||||
|
||||
path := filepath.Join(tmpDir, tmpFileName+".tmp")
|
||||
w, err := os.Create(path)
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
|
||||
@@ -30,6 +29,7 @@ import (
|
||||
spectypes "github.com/fission/fission/pkg/fission-cli/cmd/spec/types"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
)
|
||||
|
||||
type InitSubCommand struct {
|
||||
@@ -66,11 +66,7 @@ func (opts *InitSubCommand) complete(input cli.Input) error {
|
||||
|
||||
deployID := input.String(flagkey.SpecDeployID)
|
||||
if len(deployID) == 0 {
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error generating UUID")
|
||||
}
|
||||
deployID = id.String()
|
||||
deployID = uuid.NewString()
|
||||
}
|
||||
|
||||
// Create spec dir
|
||||
|
||||
@@ -21,10 +21,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||
"github.com/fission/fission/pkg/utils/uuid"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/robfig/cron/v3"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||
@@ -55,11 +55,7 @@ func (opts *CreateSubCommand) do(input cli.Input) error {
|
||||
func (opts *CreateSubCommand) complete(input cli.Input) (err error) {
|
||||
name := input.String(flagkey.TtName)
|
||||
if len(name) == 0 {
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
name = id.String()
|
||||
name = uuid.NewString()
|
||||
}
|
||||
|
||||
fnName := input.String(flagkey.TtFnName)
|
||||
|
||||
Reference in New Issue
Block a user