diff options
author | Sean E. Russell <ser@ser1.net> | 2020-04-16 08:14:13 -0500 |
---|---|---|
committer | Sean E. Russell <ser@ser1.net> | 2020-04-16 08:46:57 -0500 |
commit | 6cc74d5f5fdeca4469cd94550fcedbfe343828b2 (patch) | |
tree | de91f5d0c7d6bb43cef3e4e2d06905a281293652 /cmd/gotop/main.go | |
parent | 6cef30ba5156f5aff1924f684be324670998644c (diff) |
Switch away from Go Plugin API for the time being.
Diffstat (limited to 'cmd/gotop/main.go')
-rw-r--r-- | cmd/gotop/main.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index fc2ac7a..4888f07 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -8,7 +8,6 @@ import ( "os" "os/signal" "path/filepath" - "plugin" "strconv" "strings" "syscall" @@ -463,12 +462,6 @@ func run() int { } ly := layout.ParseLayout(lstream) - err = loadExtensions(conf) - if err != nil { - stderrLogger.Print(err) - return 1 - } - if conf.Test { return runTests(conf) } @@ -546,48 +539,6 @@ func getLayout(conf gotop.Config) (io.Reader, error) { } } -func loadExtensions(conf gotop.Config) error { - var hasError bool - for _, ex := range conf.Extensions { - exf := ex + ".so" - fn := exf - folder := conf.ConfigDir.QueryFolderContainsFile(fn) - if folder == nil { - paths := make([]string, 0) - for _, d := range conf.ConfigDir.QueryFolders(configdir.Existing) { - paths = append(paths, d.Path) - } - log.Printf("unable find extension %s in %s", fn, strings.Join(paths, ", ")) - hasError = true - continue - } - fp := filepath.Join(folder.Path, fn) - p, err := plugin.Open(fp) - if err != nil { - hasError = true - log.Printf(err.Error()) - continue - } - init, err := p.Lookup("Init") - if err != nil { - hasError = true - log.Printf(err.Error()) - continue - } - initFunc, ok := init.(func()) - if !ok { - hasError = true - log.Printf(err.Error()) - continue - } - initFunc() - } - if hasError { - return fmt.Errorf("error initializing plugins") - } - return nil -} - func runTests(conf gotop.Config) int { fmt.Printf("PASS") return 0 |