From 3dfa592e96f2bac9c8590c09a855b70344829020 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 17 May 2024 21:50:16 +0200 Subject: [PATCH] chore: migrate to wp-plugin-go v3 (#120) --- go.mod | 2 +- go.sum | 4 ++-- internal/doc/main.go | 6 +++--- plugin/impl.go | 6 +++--- plugin/plugin.go | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 18f9b8f..20a6bc3 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/google/go-github/v62 v62.0.0 github.com/rs/zerolog v1.32.0 github.com/stretchr/testify v1.9.0 - github.com/thegeeklab/wp-plugin-go/v2 v2.3.1 + github.com/thegeeklab/wp-plugin-go/v3 v3.0.2 github.com/urfave/cli/v2 v2.27.2 golang.org/x/oauth2 v0.20.0 ) diff --git a/go.sum b/go.sum index 4dc0b9a..2cefb8b 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 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/thegeeklab/wp-plugin-go/v2 v2.3.1 h1:ARwYgTPZ5iPsmOenmqcCf8TjiEe8wBOHKO7H/Xshe48= -github.com/thegeeklab/wp-plugin-go/v2 v2.3.1/go.mod h1:0t8M8txtEFiaB6RqLX8vLrxkqAo5FT5Hx7dztN592D4= +github.com/thegeeklab/wp-plugin-go/v3 v3.0.2 h1:Mv5i8S1WY+BUNjTjX6lOnB3p8S9mvM+XwfY4R98gx0g= +github.com/thegeeklab/wp-plugin-go/v3 v3.0.2/go.mod h1:ij1iJcAVgzerBTqXnmq0bu1VA+hhVVwzXKqiqfoGjjg= github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI= github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM= github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw= diff --git a/internal/doc/main.go b/internal/doc/main.go index a7dea5f..cdf1e71 100644 --- a/internal/doc/main.go +++ b/internal/doc/main.go @@ -11,8 +11,8 @@ import ( "time" "github.com/thegeeklab/wp-github-comment/plugin" - "github.com/thegeeklab/wp-plugin-go/v2/docs" - "github.com/thegeeklab/wp-plugin-go/v2/template" + plugin_docs "github.com/thegeeklab/wp-plugin-go/v3/docs" + plugin_template "github.com/thegeeklab/wp-plugin-go/v3/template" ) func main() { @@ -23,7 +23,7 @@ func main() { p := plugin.New(nil) - out, err := template.Render(context.Background(), client, tmpl, docs.GetTemplateData(p.App)) + out, err := plugin_template.Render(context.Background(), client, tmpl, plugin_docs.GetTemplateData(p.App)) if err != nil { panic(err) } diff --git a/plugin/impl.go b/plugin/impl.go index 67e3687..9df5d9e 100644 --- a/plugin/impl.go +++ b/plugin/impl.go @@ -10,7 +10,7 @@ import ( "github.com/rs/zerolog/log" gh "github.com/thegeeklab/wp-github-comment/github" - "github.com/thegeeklab/wp-plugin-go/v2/file" + plugin_file "github.com/thegeeklab/wp-plugin-go/v3/file" ) var ErrPluginEventNotSupported = errors.New("event not supported") @@ -37,7 +37,7 @@ func (p *Plugin) Validate() error { } if p.Settings.Message != "" { - if p.Settings.Message, p.Settings.IsFile, err = file.ReadStringOrFile(p.Settings.Message); err != nil { + if p.Settings.Message, p.Settings.IsFile, err = plugin_file.ReadStringOrFile(p.Settings.Message); err != nil { return fmt.Errorf("error while reading %s: %w", p.Settings.Message, err) } } @@ -57,7 +57,7 @@ func (p *Plugin) Validate() error { p.Settings.Key = fmt.Sprintf("%x", hash) } - if p.Settings.Key, _, err = file.ReadStringOrFile(p.Settings.Key); err != nil { + if p.Settings.Key, _, err = plugin_file.ReadStringOrFile(p.Settings.Key); err != nil { return fmt.Errorf("error while reading %s: %w", p.Settings.Key, err) } diff --git a/plugin/plugin.go b/plugin/plugin.go index 6137cc0..efb29ac 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -4,7 +4,7 @@ import ( "fmt" "net/url" - wp "github.com/thegeeklab/wp-plugin-go/v2/plugin" + plugin_base "github.com/thegeeklab/wp-plugin-go/v3/plugin" "github.com/urfave/cli/v2" ) @@ -12,7 +12,7 @@ import ( // Plugin implements provide the plugin. type Plugin struct { - *wp.Plugin + *plugin_base.Plugin Settings *Settings } @@ -30,15 +30,15 @@ type Settings struct { baseURL *url.URL } -func New(e wp.ExecuteFunc, build ...string) *Plugin { +func New(e plugin_base.ExecuteFunc, build ...string) *Plugin { p := &Plugin{ Settings: &Settings{}, } - options := wp.Options{ + options := plugin_base.Options{ Name: "wp-github-comment", Description: "Add comments to GitHub Issues and Pull Requests", - Flags: Flags(p.Settings, wp.FlagsPluginCategory), + Flags: Flags(p.Settings, plugin_base.FlagsPluginCategory), Execute: p.run, HideWoodpeckerFlags: true, } @@ -55,7 +55,7 @@ func New(e wp.ExecuteFunc, build ...string) *Plugin { options.Execute = e } - p.Plugin = wp.New(options) + p.Plugin = plugin_base.New(options) return p }