kubo/plugin/plugin.go
Marcin Rataj 6a008fc74c
refactor: apply go fix modernizers from Go 1.26 (#11190)
* chore: apply go fix modernizers from Go 1.26

automated refactoring: interface{} to any, slices.Contains,
and other idiomatic updates.

* feat(ci): add `go fix` check to Go analysis workflow

ensures Go 1.26 modernizers are applied, fails CI if `go fix ./...`
produces any changes (similar to existing `go fmt` enforcement)
2026-02-11 01:01:32 +01:00

34 lines
1.1 KiB
Go

package plugin
// Environment is the environment passed into the plugin on init.
type Environment struct {
// Path to the IPFS repo.
Repo string
// The plugin's config, if specified in the
// Plugins.Plugins["plugin-name"].Config field of the user's go-ipfs
// config. See docs/plugins.md for details.
//
// This is an arbitrary JSON-like object unmarshaled into an interface{}
// according to https://golang.org/pkg/encoding/json/#Unmarshal.
Config any
}
// Plugin is the base interface for all kinds of go-ipfs plugins
// It will be included in interfaces of different Plugins
//
// Optionally, Plugins can implement io.Closer if they want to
// have a termination step when unloading.
type Plugin interface {
// Name should return unique name of the plugin
Name() string
// Version returns current version of the plugin
Version() string
// Init is called once when the Plugin is being loaded
// The plugin is passed an environment containing the path to the
// (possibly uninitialized) IPFS repo and the plugin's config.
Init(env *Environment) error
}