fix: make readme example compile (#17)

Resolves #16

Also formatted it.

https://go.dev/play/p/sFpiRTwLGlq
Reviewed-on: https://codeberg.org/woodpecker-plugins/go-plugin/pulls/17
Reviewed-by: Patrick Schratz <pat-s@noreply.codeberg.org>
Co-authored-by: jolheiser <jolheiser@noreply.codeberg.org>
Co-committed-by: jolheiser <jolheiser@noreply.codeberg.org>
This commit is contained in:
jolheiser 2023-11-15 17:33:12 +00:00 committed by Patrick Schratz
parent f1c4c040ce
commit 275eb26ca7
1 changed files with 34 additions and 32 deletions

View File

@ -18,12 +18,14 @@ HTTP client library.
## Creating plugin
```go
package main
import (
"context"
"codeberg.org/woodpecker-plugins/go-plugin"
"github.com/urfave/cli/v2"
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"
)
type Settings struct {
@ -56,10 +58,10 @@ func (p *Plugin) Execute(ctx context.Context) error {
func main() {
p := &Plugin{
&Settings{}
Settings: &Settings{},
}
p.Plugin = plugin.New(Options{
p.Plugin = plugin.New(plugin.Options{
Name: "sample-plugin",
Description: "Sample plugin",
Flags: p.Flags(),