func (cf *CanFile) ReadDefault() error {
	// the list of files to try and read
	var files []string

	// first try the GGMAN_CANFILE
	canfile := os.Getenv("GGMAN_CANFILE")
	if canfile != "" {
		files = append(files, canfile)
	}

	// and then $HOME/.ggman
	usr, err := user.Current()
	if err == nil {
		files = append(files, path.Join(usr.HomeDir, ".ggman"))
	}

	// if a canfile exists, read it
	for _, file := range files {
		if _, err := os.Stat(file); !os.IsNotExist(err) {
			return errors.Wrapf(cf.unmarshalFile(file), "Error reading CanFile %q", file)
		}
	}

	// fallback to the default
	return cf.loadDefault()
}
// ReadDefault reads the default canonical file
// if it does not exist, loads the default contents
ReadDefault reads the default canonical file
if it does not exist, loads the default contents
// ReadDefault reads the default canonical file // if it does not exist loads the default contents
func (cf *CanFile) ReadDefault() error {
	var files []string
	canfile := os.Getenv("GGMAN_CANFILE")
	if canfile != "" {
		files = append(files, canfile)
	}
	usr, err := user.Current()
	if err == nil {
		files = append(files, path.Join(usr.HomeDir, ".ggman"))
	}
	for _, file := range files {
		if _, err := os.Stat(file); !os.IsNotExist(err) {
			return errors.Wrapf(cf.unmarshalFile(file), "Error reading CanFile %q", file)
		}
	}
	return cf.loadDefault()
}
func ( cf * CanFile ) ReadDefault ( ) error { var files [ ] string canfile := os . Getenv ( " " ) if canfile != " " { files = append ( files , canfile ) } usr , err := user . Current ( ) if err == nil { files = append ( files , path . Join ( usr . HomeDir , " " ) ) } for _ , file := range files { if _ , err := os . Stat ( file ) ; ! os . IsNotExist ( err ) { return errors . Wrapf ( cf . unmarshalFile ( file ) , " " , file ) } } return cf . loadDefault ( ) }
ReadDefault reads the default canonical file
if it does not exist, loads the default contents
ReadDefault reads the default canonical file if it does not exist loads the default contents
// the list of files to try and read // first try the GGMAN_CANFILE // and then $HOME/.ggman // if a canfile exists, read it // fallback to the default