func Scan() ([]string, error) {
	var names []string
	if err := filepath.Walk(socketsPath, func(path string, fi os.FileInfo, err error) error {
		if err != nil {
			return nil
		}
		if fi.Mode()&os.ModeSocket != 0 {
			name := strings.TrimSuffix(fi.Name(), filepath.Ext(fi.Name()))
			names = append(names, name)
		}
		return nil
	}); err != nil {
		return nil, err
	}
	for _, path := range specsPaths {
		if err := filepath.Walk(path, func(p string, fi os.FileInfo, err error) error {
			if err != nil || fi.IsDir() {
				return nil
			}
			name := strings.TrimSuffix(fi.Name(), filepath.Ext(fi.Name()))
			names = append(names, name)
			return nil
		}); err != nil {
			return nil, err
		}
	}
	return names, nil
}
Scan scans all the plugin paths and returns all the names it found
package plugins
import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	"sync"
)
var (
	ErrNotFound = errors.New("plugin not found")
	socketsPath = "/run/docker/plugins"
)
type localRegistry struct{}
func newLocalRegistry() localRegistry {
	return localRegistry{}
}