code: func Scan() ([]string, error) {
  	var names []string
  	dirEntries, err := ioutil.ReadDir(socketsPath)
  	if err != nil && !os.IsNotExist(err) {
  		return nil, errors.Wrap(err, "error reading dir entries")
  	}
  
  	for _, fi := range dirEntries {
  		if fi.IsDir() {
  			fi, err = os.Stat(filepath.Join(socketsPath, fi.Name(), fi.Name()+".sock"))
  			if err != nil {
  				continue
  			}
  		}
  
  		if fi.Mode()&os.ModeSocket != 0 {
  			names = append(names, strings.TrimSuffix(filepath.Base(fi.Name()), filepath.Ext(fi.Name())))
  		}
  	}
  
  	for _, p := range specsPaths {
  		dirEntries, err := ioutil.ReadDir(p)
  		if err != nil && !os.IsNotExist(err) {
  			return nil, errors.Wrap(err, "error reading dir entries")
  		}
  
  		for _, fi := range dirEntries {
  			if fi.IsDir() {
  				infos, err := ioutil.ReadDir(filepath.Join(p, fi.Name()))
  				if err != nil {
  					continue
  				}
  
  				for _, info := range infos {
  					if strings.TrimSuffix(info.Name(), filepath.Ext(info.Name())) == fi.Name() {
  						fi = info
  						break
  					}
  				}
  			}
  
  			ext := filepath.Ext(fi.Name())
  			switch ext {
  			case ".spec", ".json":
  				plugin := strings.TrimSuffix(fi.Name(), ext)
  				names = append(names, plugin)
  			default:
  			}
  		}
  	}
  	return names, nil
  }
docs: // Scan scans all the plugin paths and returns all the names it found