aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/go-plugin/discover.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/go-plugin/discover.go')
-rw-r--r--vendor/github.com/hashicorp/go-plugin/discover.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-plugin/discover.go b/vendor/github.com/hashicorp/go-plugin/discover.go
new file mode 100644
index 0000000..d22c566
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-plugin/discover.go
@@ -0,0 +1,28 @@
1package plugin
2
3import (
4 "path/filepath"
5)
6
7// Discover discovers plugins that are in a given directory.
8//
9// The directory doesn't need to be absolute. For example, "." will work fine.
10//
11// This currently assumes any file matching the glob is a plugin.
12// In the future this may be smarter about checking that a file is
13// executable and so on.
14//
15// TODO: test
16func Discover(glob, dir string) ([]string, error) {
17 var err error
18
19 // Make the directory absolute if it isn't already
20 if !filepath.IsAbs(dir) {
21 dir, err = filepath.Abs(dir)
22 if err != nil {
23 return nil, err
24 }
25 }
26
27 return filepath.Glob(filepath.Join(dir, glob))
28}