func ParseFile(name string) (*Config, error) {
	file, err := os.Open(name)
	if err != nil {
		return nil, err
	}

	cfg := &Config{
		sync.RWMutex{},
		make(map[string]string),
		make([]byte, 0),
		file.Name(),
	}
	cfg.Lock()
	defer cfg.Unlock()
	defer file.Close()

	gotSeparator := false
	s := NewScanner(file)

	for found := s.Scan(); found; found = s.Scan() {
		if found {
			k, v := s.Text()
			cfg.data[k] = v

			if !gotSeparator {
				cfg.separator = s.Separator()
				gotSeparator = true
			}
			continue
		} else if s.Err() != nil {
			return nil, err
		}
	}

	return cfg, nil
}
func ParseFile(name string) (*Config, error) {
	file, err := os.Open(name)
	if err != nil {
		return nil, err
	}

	cfg := &Config{
		sync.RWMutex{},
		make(map[string]string),
		make([]byte, 0),
		file.Name(),
	}
	cfg.Lock()
	defer cfg.Unlock()
	defer file.Close()

	gotSeparator := false
	s := NewScanner(file)

	for found := s.Scan(); found; found = s.Scan() {
		if found {
			k, v := s.Text()
			cfg.data[k] = v

			if !gotSeparator {
				cfg.separator = s.Separator()
				gotSeparator = true
			}
			continue
		} else if s.Err() != nil {
			return nil, err
		}
	}

	return cfg, nil
}
func ParseFile ( name string ) ( * Config , error ) { file , err := os . Open ( name ) if err != nil { return nil , err } cfg := & Config { sync . RWMutex { } , make ( map [ string ] string ) , make ( [ ] byte , 0 ) , file . Name ( ) , } cfg . Lock ( ) defer cfg . Unlock ( ) defer file . Close ( ) gotSeparator := false s := NewScanner ( file ) for found := s . Scan ( ) ; found ; found = s . Scan ( ) { if found { k , v := s . Text ( ) cfg . data [ k ] = v if ! gotSeparator { cfg . separator = s . Separator ( ) gotSeparator = true } continue } else if s . Err ( ) != nil { return nil , err } } return cfg , nil }
// ParseFile creates a new Config and parses the file configuration from the
// named file.
ParseFile creates a new Config and parses the file configuration from the named file .