gconfig.go
func readPropertyFile(fi os.FileInfo, cfpath string) (configFile, error) {
	cf := configFile{fileInfo: fi, configs: make(map[string]interface{})}

	f, err := os.Open(cfpath)
	if err != nil {
		return configFile{}, err
	}
	defer f.Close()

	sc := bufio.NewScanner(f)
	sc.Split(bufio.ScanLines)
	for sc.Scan() {
		l := sc.Text()
		kv := s.Split(l, "=")
		if len(kv) < 2 {
			continue
		} else if len(kv) == 2 {
			cf.addProperty(kv[0], kv[1])
		} else {
			//= after first is all part of the value
			pv := s.Replace(l, fmt.Sprintf("%s=", kv[0]), "", -1)
			cf.addProperty(kv[0], pv)
		}
	}

	return cf, nil
}
func readPropertyFile(fi os.FileInfo, cfpath string) (configFile, error) {
	cf := configFile{fileInfo: fi, configs: make(map[string]interface{})}

	f, err := os.Open(cfpath)
	if err != nil {
		return configFile{}, err
	}
	defer f.Close()

	sc := bufio.NewScanner(f)
	sc.Split(bufio.ScanLines)
	for sc.Scan() {
		l := sc.Text()
		kv := s.Split(l, "=")
		if len(kv) < 2 {
			continue
		} else if len(kv) == 2 {
			cf.addProperty(kv[0], kv[1])
		} else {
			//= after first is all part of the value
			pv := s.Replace(l, fmt.Sprintf("%s=", kv[0]), "", -1)
			cf.addProperty(kv[0], pv)
		}
	}

	return cf, nil
}
func readPropertyFile ( fi os . FileInfo , cfpath string ) ( configFile , error ) { cf := configFile { fileInfo : fi , configs : make ( map [ string ] interface { } ) } f , err := os . Open ( cfpath ) if err != nil { return configFile { } , err } defer f . Close ( ) sc := bufio . NewScanner ( f ) sc . Split ( bufio . ScanLines ) for sc . Scan ( ) { l := sc . Text ( ) kv := s . Split ( l , " " ) if len ( kv ) < 2 { continue } else if len ( kv ) == 2 { cf . addProperty ( kv [ 0 ] , kv [ 1 ] ) } else { //= after first is all part of the value pv := s . Replace ( l , fmt . Sprintf ( " " , kv [ 0 ] ) , " " , - 1 ) cf . addProperty ( kv [ 0 ] , pv ) } } return cf , nil }
// readPropertyFile opens the configuration file and creates configuration struct with all the key/value pair info.
// It ignores any line that begins with # and silently ignores line without correct key/value pair format.
readPropertyFile opens the configuration file and creates configuration struct with all the key / value pair info . It ignores any line that begins with # and silently ignores line without correct key / value pair format .