MCPcopy
hub / github.com/pelletier/go-toml / pluginConfig

Struct pluginConfig

unmarshaler_test.go:102–105  ·  view source on GitHub ↗

pluginConfig demonstrates how to implement dynamic unmarshaling based on a "type" field. This pattern is useful for plugin systems or polymorphic configuration.

Source from the content-addressed store, hash-verified

100// based on a "type" field. This pattern is useful for plugin systems
101// or polymorphic configuration.
102type pluginConfig struct {
103 Type string
104 Config any
105}
106
107func (p *pluginConfig) UnmarshalTOML(data []byte) error {
108 // First, decode just the type field

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected