code: func (l *localRegistry) Plugin(name string) (*Plugin, error) {
  	socketpaths := pluginPaths(socketsPath, name, ".sock")
  
  	for _, p := range socketpaths {
  		if fi, err := os.Stat(p); err == nil && fi.Mode()&os.ModeSocket != 0 {
  			return NewLocalPlugin(name, "unix://"+p), nil
  		}
  	}
  
  	var txtspecpaths []string
  	for _, p := range specsPaths {
  		txtspecpaths = append(txtspecpaths, pluginPaths(p, name, ".spec")...)
  		txtspecpaths = append(txtspecpaths, pluginPaths(p, name, ".json")...)
  	}
  
  	for _, p := range txtspecpaths {
  		if _, err := os.Stat(p); err == nil {
  			if strings.HasSuffix(p, ".json") {
  				return readPluginJSONInfo(name, p)
  			}
  			return readPluginInfo(name, p)
  		}
  	}
  	return nil, errors.Wrapf(ErrNotFound, "could not find plugin %s in v1 plugin registry", name)
  }
docs: // Plugin returns the plugin registered with the given name (or returns an error).