func isEmpty(path string) bool {
	fi, err := os.Stat(path)
	if err != nil {
		er(err)
	}
	if fi.IsDir() {
		f, err := os.Open(path)
		if err != nil {
			er(err)
		}
		defer f.Close()
		dirs, err := f.Readdirnames(1)
		if err != nil && err != io.EOF {
			er(err)
		}
		return len(dirs) == 0
	}
	return fi.Size() == 0
}
isEmpty checks if a given path is empty.
package cmd
import (
	"bytes"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"strings"
	"text/template"
)
var cmdDirs = [...]string{"cmd", "cmds", "command", "commands"}
var srcPaths []string
func init() {
	envGoPath := os.Getenv("GOPATH")
	goPaths := filepath.SplitList(envGoPath)
	if len(goPaths) == 0 {
		er("$GOPATH is not set")
	}
	srcPaths = make([]string, 0, len(goPaths))
	for _, goPath := range goPaths {
		srcPaths = append(srcPaths, filepath.Join(goPath, "src"))
	}
}
func er(msg interface{}) {
	fmt.Println("Error:", msg)
	os.Exit(1)
}