Skip to content

Commit d7fbff0

Browse files
authored
Use new plugin sdk interface to build example plugin (#5699)
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
1 parent 87fd885 commit d7fbff0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/app/pipedv1/plugin/example/main.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ import (
2121
)
2222

2323
func main() {
24-
sdk.RegisterStagePlugin(&plugin{})
24+
plugin, err := sdk.NewPlugin("example", "0.0.1", sdk.WithStagePlugin(&plugin{}))
25+
if err != nil {
26+
log.Fatalln(err)
27+
}
2528

26-
if err := sdk.Run(); err != nil {
29+
if err := plugin.Run(); err != nil {
2730
log.Fatalln(err)
2831
}
2932
}

pkg/app/pipedv1/plugin/example/plugin.go

+2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ type plugin struct{}
2525
type config struct{}
2626

2727
// Name implements sdk.Plugin.
28+
// TODO: remove this method after changing the sdk.StagePlugin interface.
2829
func (p *plugin) Name() string {
2930
return "example"
3031
}
3132

3233
// Version implements sdk.Plugin.
34+
// TODO: remove this method after changing the sdk.StagePlugin interface.
3335
func (p *plugin) Version() string {
3436
return "0.0.1"
3537
}

0 commit comments

Comments
 (0)