func (m *Manager) Installed() ([]*GoVersion, error) {
	files, err := ioutil.ReadDir(m.versionsDir)
	if err != nil {
		return nil, err
	}
	versionSuffix := fmt.Sprintf(".%v.%v", m.GOOS, m.GOARCH)
	var list []*GoVersion
	for _, fi := range files {
		name := fi.Name()
		name = strings.TrimSuffix(name, versionSuffix)
		name = strings.TrimPrefix(name, "go")
		v, err := ParseVersion(name)
		if err != nil {
			continue
		}
		list = append(list, v)
	}
	sortVersions(list)
	return list, nil
}
Installed returns all installed go version
package gvm
import (
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"runtime"
	"strings"
	"github.com/sirupsen/logrus"
	"github.com/andrewkroh/gvm/common"
)
type Manager struct {
	Home string
	GOOS string
	GOARCH string
	GoStorageHome string
	GoSourceURL string
	Logger logrus.FieldLogger
	cacheDir    string
	versionsDir string
	logsDir     string
}
func (m *Manager) Init() error {
	if m.Home == "" {
		home, err := homeDir()
		if err != nil {
			return err
		}
		m.Home = filepath.Join(home, ".gvm")
	}
	if m.GoStorageHome == "" {
		m.GoStorageHome = "https://storage.googleapis.com/golang"
	}
	if m.GoSourceURL == "" {
		m.GoSourceURL = "https://go.googlesource.com/go"
	}
	if m.GOOS == "" {
		m.GOOS = runtime.GOOS
	}
	if m.GOARCH == "" {
		switch runtime.GOARCH {
		default:
			m.GOARCH = runtime.GOARCH
		case "arm":
			m.GOARCH = "armv6l"
		}
	}
	if m.Logger == nil {
		m.Logger = logrus.StandardLogger()
	}
	m.cacheDir = filepath.Join(m.Home, "cache")
	m.versionsDir = filepath.Join(m.Home, "versions")
	m.logsDir = filepath.Join(m.Home, "logs")
	return m.ensureDirStruct()
}
func (m *Manager) UpdateCache() error {
	return m.updateSrcCache()
}
func (m *Manager) ensureDirStruct() error {
	for _, dir := range []string{m.cacheDir, m.versionsDir, m.logsDir} {
		if err := os.MkdirAll(dir, os.ModeDir|0755); err != nil {
			return err
		}
	}
	return nil
}
func (m *Manager) Available() ([]*GoVersion, []bool, error) {
	if !m.hasSrcCache() {
		versions, err := m.AvailableBinaries()
		if err != nil {
			return nil, nil, err
		}
		hasBin := make([]bool, len(versions))
		for i := range hasBin {
			hasBin[i] = true
		}
		return versions, hasBin, nil
	}
	src, err := m.AvailableSource()
	if err != nil {
		return nil, nil, err
	}
	hasBin := make([]bool, len(src))
	bin, err := m.AvailableBinaries()
	if err != nil {
		return src, hasBin, nil
	}
	for i, ver := range src {
		hasBin[i] = findVersion(ver, bin) >= 0
	}
	return src, hasBin, nil
}
func (m *Manager) Remove(version *GoVersion) error {
	dir := m.VersionGoROOT(version)
	fi, err := os.Stat(dir)
	if os.IsNotExist(err) {
		return fmt.Errorf("Version %v not installed\n", version)
	}
	if !fi.IsDir() {
		return fmt.Errorf("Path %v is no directory", dir)
	}
	return os.RemoveAll(dir)
}