Skip to content

Instantly share code, notes, and snippets.

@knakayama
Created November 23, 2015 04:39
Show Gist options
  • Save knakayama/f4839313b07d177f6fb0 to your computer and use it in GitHub Desktop.
Save knakayama/f4839313b07d177f6fb0 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"github.com/caarlos0/gohome"
)
func main() {
list()
}
func list() {
home := home()
bundles, err := ioutil.ReadDir(home)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
for _, bundle := range bundles {
if bundle.Mode().IsDir() && bundle.Name()[0] != '.' {
fmt.Println(filepath.Join(home, bundle.Name()))
}
}
}
func home() string {
home := os.Getenv("ANTIBODY_HOME")
if home == "" {
home = gohome.Cache("antibody")
}
return home
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment