Skip to content

Commit

Permalink
fix: check for not exists error
Browse files Browse the repository at this point in the history
When trying to load plugins this change now checks if we get a not
exists error and just returns, so as to handle the case where no plugins
are set

Signed-off-by: Spazzy <brendankamp757@gmail.com>
  • Loading branch information
Spazzy757 committed Apr 24, 2024
1 parent 7d5810a commit 1ac00f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/plugin/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package plugin

import (
"context"
"errors"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -110,6 +111,9 @@ func (e *ExportPluginSystem) Load(ctx context.Context) error {

// Open the plugin directory.
files, err := os.ReadDir(e.Dir)
if errors.Is(err, os.ErrNotExist) {
return nil
}
if err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/plugin/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package plugin

import (
"context"
"errors"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -138,6 +139,9 @@ func (s *SourcePluginSystem) Load(ctx context.Context) error {

// Open the plugin directory.
files, err := os.ReadDir(s.Dir)
if errors.Is(err, os.ErrNotExist) {
return nil
}
if err != nil {
return err
}
Expand Down

0 comments on commit 1ac00f5

Please sign in to comment.