Skip to content

Commit

Permalink
Merge branch 'master' of github.com:LeakIX/l9format
Browse files Browse the repository at this point in the history
  • Loading branch information
gboddin committed May 19, 2021
2 parents b5095cf + 07d7b07 commit 4d13559
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions l9plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
## Implementation rules

- Plugin must be a `struct` implementing either `ServicePluginInterface` or `WebPluginInterface`
- Plugin must implement a New func :
```go

func New() l9format.ServicePluginInterface {
return MyPluginStruct{}
}
```
- Plugin should embed `ServicePluginBase`
- And use its network facility whenever possible
- Plugin must respect the context it's provided as much as made possible by the driver
Expand All @@ -18,17 +11,16 @@ func New() l9format.ServicePluginInterface {
- Plugin must set `leak` information before setting `hasLeak`
- Plugin must assume `options` can be uninitialized and `nil`

## Building plugins
## Creating/building plugins

```
go build -trimpath -ldflags "-s -w" -o myplugin.so -buildmode=plugin
```
Plugins are embeded in `l9explore`. Once you created a repository with your plugin, you can update l9explore's [plugin map](https://github.com/LeakIX/l9explore/blob/v1.0.0-beta.2/plugin_map.go) file and build a new version containing your plugin.

The `--debug` flag can be used to confirm the plugins are loading properly.

## Example

```go
package main
package redis_open

import (
"context"
Expand All @@ -43,10 +35,6 @@ type RedisOpenPlugin struct {
l9format.ServicePluginBase
}

func New() l9format.ServicePluginInterface {
return RedisOpenPlugin{}
}

func (RedisOpenPlugin) GetVersion() (int, int, int) {
return 0, 0, 1
}
Expand Down

0 comments on commit 4d13559

Please sign in to comment.