From 4da6a19be37b943f32d7f12f97e1cee3147e8bf1 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 20 May 2024 12:41:42 +1200 Subject: [PATCH] Use `google/uuid` rather than `twinj/uuid` https://github.com/twinj/uuid was last updated in 2017 and has been archived since 2020. Additionally `twinj/uuid` pulls in a non-existent `github.com/myesui/uuid` which causes `go mod download` to fail. --- builder/graph.go | 4 ++-- builder/tree.go | 10 +++++----- cmd/console.go | 6 +++--- cmd/html_report.go | 10 +++++----- cmd/report.go | 6 +++--- cmd/summary.go | 6 +++--- go.mod | 4 +--- go.sum | 8 ++------ 8 files changed, 24 insertions(+), 30 deletions(-) diff --git a/builder/graph.go b/builder/graph.go index 1a6b095..05b3aef 100644 --- a/builder/graph.go +++ b/builder/graph.go @@ -5,10 +5,10 @@ package builder import ( "fmt" + "github.com/google/uuid" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" wcModel "github.com/pb33f/libopenapi/what-changed/model" "github.com/pb33f/openapi-changes/model" - "github.com/twinj/uuid" "reflect" "strings" ) @@ -227,7 +227,7 @@ func exploreGraphObject(parent *model.NodeData[any], object any, nodes *[]*model } func buildId(label string) string { - return fmt.Sprintf("%s-%s", strings.ToLower(label), uuid.NewV4().String()[:6]) + return fmt.Sprintf("%s-%s", strings.ToLower(label), uuid.New().String()[:6]) } func calcWidth(label string) int { diff --git a/builder/tree.go b/builder/tree.go index c28f8ff..fdfac5d 100644 --- a/builder/tree.go +++ b/builder/tree.go @@ -4,11 +4,11 @@ package builder import ( + "github.com/google/uuid" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" wcModel "github.com/pb33f/libopenapi/what-changed/model" "github.com/pb33f/libopenapi/what-changed/reports" "github.com/pb33f/openapi-changes/model" - "github.com/twinj/uuid" "golang.org/x/text/cases" "golang.org/x/text/language" "reflect" @@ -86,7 +86,7 @@ func exploreTreeObject(parent *model.TreeNode, object any) { parent.Children = append(parent.Children, &model.TreeNode{ TitleString: title, - Key: uuid.NewV4().String(), + Key: uuid.New().String(), Change: topChanges[x], IsLeaf: true, Selectable: true, @@ -290,7 +290,7 @@ func DigIntoTreeNode[T any](parent *model.TreeNode, field reflect.Value, label s if !field.IsZero() { e := &model.TreeNode{ TitleString: label, - Key: uuid.NewV4().String(), + Key: uuid.New().String(), IsLeaf: false, Selectable: false, TotalChanges: tc, @@ -309,7 +309,7 @@ func DigIntoTreeNodeSlice[T any](parent *model.TreeNode, field reflect.Value, la f := field.Index(k) e := &model.TreeNode{ TitleString: label, - Key: uuid.NewV4().String(), + Key: uuid.New().String(), IsLeaf: false, Selectable: false, Disabled: false, @@ -336,7 +336,7 @@ func BuildTreeMapNode(parent *model.TreeNode, field reflect.Value) { default: tn := &model.TreeNode{ TitleString: e.String(), - Key: uuid.NewV4().String(), + Key: uuid.New().String(), IsLeaf: false, Selectable: false, Disabled: false, diff --git a/cmd/console.go b/cmd/console.go index 103cf20..f076359 100644 --- a/cmd/console.go +++ b/cmd/console.go @@ -13,12 +13,12 @@ import ( "path/filepath" "time" + "github.com/google/uuid" "github.com/pb33f/openapi-changes/git" "github.com/pb33f/openapi-changes/model" "github.com/pb33f/openapi-changes/tui" "github.com/pterm/pterm" "github.com/spf13/cobra" - "github.com/twinj/uuid" ) func GetConsoleCommand() *cobra.Command { @@ -360,13 +360,13 @@ func runLeftRightCompare(left, right string, updateChan chan *model.ProgressUpda commits := []*model.Commit{ { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("New: %s, Original: %s", right, left), CommitDate: time.Now(), Data: rightBytes, }, { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("Original file: %s", left), CommitDate: time.Now(), Data: leftBytes, diff --git a/cmd/html_report.go b/cmd/html_report.go index 32bfaf7..9f4cd2c 100644 --- a/cmd/html_report.go +++ b/cmd/html_report.go @@ -8,13 +8,13 @@ import ( "encoding/hex" "errors" "fmt" + "github.com/google/uuid" "github.com/pb33f/libopenapi/index" "github.com/pb33f/openapi-changes/git" htmlReport "github.com/pb33f/openapi-changes/html-report" "github.com/pb33f/openapi-changes/model" "github.com/pterm/pterm" "github.com/spf13/cobra" - "github.com/twinj/uuid" "net/url" "os" "path/filepath" @@ -410,13 +410,13 @@ func RunLeftRightHTMLReport(left, right string, useCDN bool, commits := []*model.Commit{ { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("New: %s, Original: %s", right, left), CommitDate: time.Now(), Data: rightBytes, }, { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("Original file: %s", left), CommitDate: time.Now(), Data: leftBytes, @@ -442,13 +442,13 @@ func RunLeftRightHTMLReportViaString(left, right string, useCDN, embedded bool, commits := []*model.Commit{ { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("Uploaded original (%d bytes)", len(left)), CommitDate: time.Now(), Data: []byte(left), }, { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("Uploaded modification (%d bytes)", len(right)), CommitDate: time.Now(), Data: []byte(right), diff --git a/cmd/report.go b/cmd/report.go index 9467041..93921bf 100644 --- a/cmd/report.go +++ b/cmd/report.go @@ -13,12 +13,12 @@ import ( "path/filepath" "time" + "github.com/google/uuid" "github.com/pb33f/libopenapi/what-changed/reports" "github.com/pb33f/openapi-changes/git" "github.com/pb33f/openapi-changes/model" "github.com/pterm/pterm" "github.com/spf13/cobra" - "github.com/twinj/uuid" ) func GetReportCommand() *cobra.Command { @@ -338,13 +338,13 @@ func runLeftRightReport(left, right string, commits := []*model.Commit{ { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("New: %s, Original: %s", right, left), CommitDate: time.Now(), Data: rightBytes, }, { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("Original file: %s", left), CommitDate: time.Now(), Data: leftBytes, diff --git a/cmd/summary.go b/cmd/summary.go index 8921c75..0172b92 100644 --- a/cmd/summary.go +++ b/cmd/summary.go @@ -17,12 +17,12 @@ import ( "strings" "time" + "github.com/google/uuid" "github.com/pb33f/libopenapi/what-changed/reports" "github.com/pb33f/openapi-changes/git" "github.com/pb33f/openapi-changes/model" "github.com/pterm/pterm" "github.com/spf13/cobra" - "github.com/twinj/uuid" ) func GetSummaryCommand() *cobra.Command { @@ -314,13 +314,13 @@ func runLeftRightSummary(left, right string, updateChan chan *model.ProgressUpda commits := []*model.Commit{ { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("New: %s, Original: %s", right, left), CommitDate: time.Now(), Data: rightBytes, }, { - Hash: uuid.NewV4().String()[:6], + Hash: uuid.New().String()[:6], Message: fmt.Sprintf("Original file: %s", left), CommitDate: time.Now(), Data: leftBytes, diff --git a/go.mod b/go.mod index 12795fa..85073df 100644 --- a/go.mod +++ b/go.mod @@ -5,12 +5,12 @@ go 1.21 require ( github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de github.com/gdamore/tcell/v2 v2.7.4 + github.com/google/uuid v1.6.0 github.com/pb33f/libopenapi v0.16.2 github.com/pterm/pterm v0.12.79 github.com/rivo/tview v0.0.0-20240424133105-0d02bb78244d github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 - github.com/twinj/uuid v1.0.0 golang.org/x/text v0.14.0 ) @@ -31,7 +31,6 @@ require ( github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/myesui/uuid v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -43,6 +42,5 @@ require ( golang.org/x/sys v0.17.0 // indirect golang.org/x/term v0.17.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/stretchr/testify.v1 v1.2.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index fdc10c6..9fa0642 100644 --- a/go.sum +++ b/go.sum @@ -57,6 +57,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= @@ -88,8 +90,6 @@ github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/myesui/uuid v1.0.0 h1:xCBmH4l5KuvLYc5L7AS7SZg9/jKdIFubM7OVoLqaQUI= -github.com/myesui/uuid v1.0.0/go.mod h1:2CDfNgU0LR8mIdO8vdWd8i9gWWxLlcoIGGpSNgafq84= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -141,8 +141,6 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/twinj/uuid v1.0.0 h1:fzz7COZnDrXGTAOHGuUGYd6sG+JMq+AoE7+Jlu0przk= -github.com/twinj/uuid v1.0.0/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY= github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= @@ -239,8 +237,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/stretchr/testify.v1 v1.2.2 h1:yhQC6Uy5CqibAIlk1wlusa/MJ3iAN49/BsR/dCCKz3M= -gopkg.in/stretchr/testify.v1 v1.2.2/go.mod h1:QI5V/q6UbPmuhtm10CaFZxED9NreB8PnFYN9JcR6TxU= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=