From ae5a41655a375f5cdf3c24ad7d16254afd595e9e Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 23 Jul 2025 12:34:51 +0300 Subject: [PATCH] fix panic --- compose/compose.go | 3 +-- compose/yaml.go | 7 ++++--- plugin.go | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/compose/compose.go b/compose/compose.go index 9879f49..5ce4b27 100644 --- a/compose/compose.go +++ b/compose/compose.go @@ -23,8 +23,7 @@ const ( ) var ( - errComposeNotExists = errors.New("plasma-compose.yaml doesn't exist") - errComposeBadStructure = errors.New("incorrect mapping for plasma-compose.yaml, ensure structure is correct") + errComposeNotExists = errors.New("plasma-compose.yaml doesn't exist") ) type keyringWrapper struct { diff --git a/compose/yaml.go b/compose/yaml.go index 3d4461a..a903d38 100644 --- a/compose/yaml.go +++ b/compose/yaml.go @@ -10,8 +10,9 @@ import ( ) const ( - // TargetLatest is fallback to latest master branch. - TargetLatest = "latest" + // TargetLatest is a fallback to the latest version. + TargetLatest = "latest" + tplComposeBadStructure = "plasma-compose.yaml parsing failed - %w" ) var ( @@ -126,7 +127,7 @@ func Lookup(fsys fs.FS) (*YamlCompose, error) { cfg, err := parseComposeYaml(f) if err != nil { - return &YamlCompose{}, errComposeBadStructure + return &YamlCompose{}, fmt.Errorf(tplComposeBadStructure, err) } return cfg, nil diff --git a/plugin.go b/plugin.go index fb89819..a782f19 100644 --- a/plugin.go +++ b/plugin.go @@ -69,6 +69,10 @@ func (p *Plugin) DiscoverActions(_ context.Context) ([]*action.Action, error) { }, p.k, ) + if err != nil { + return err + } + c.SetLogger(log) c.SetTerm(term)