// keyValuesFromLines parses given content in to a list of key-value pairs.
keyValuesFromLines parses given content in to a list of key-value pairs.
// keyValuesFromLines parses given content in to a list of key - value pairs .
func (fl *fileLoader) keyValuesFromLines(content []byte) ([]types.Pair, error) {
	var kvs []types.Pair
	scanner := bufio.NewScanner(bytes.NewReader(content))
	currentLine := 0
	for scanner.Scan() {
		scannedBytes := scanner.Bytes()
		kv, err := fl.keyValuesFromLine(scannedBytes, currentLine)
		if err != nil {
			return nil, err
		}
		currentLine++
		if len(kv.Key) == 0 {
			continue
		}
		kvs = append(kvs, kv)
	}
	return kvs, nil
}
func ( fl * fileLoader ) keyValuesFromLines ( content [ ] byte ) ( [ ] types . Pair , error ) { var kvs [ ] types . Pair scanner := bufio . NewScanner ( bytes . NewReader ( content ) ) currentLine := 0 for scanner . Scan ( ) { scannedBytes := scanner . Bytes ( ) kv , err := fl . keyValuesFromLine ( scannedBytes , currentLine ) if err != nil { return nil , err } currentLine ++ if len ( kv . Key ) == 0 { continue } kvs = append ( kvs , kv ) } return kvs , nil }
keyValuesFromLines parses given content in to a list of key-value pairs.
keyValuesFromLines parses given content in to a list of key - value pairs .
// Process the current line, retrieving a key/value pair if // possible. // no key means line was empty or a comment