func GetFileToMapPreLine(file string) []LineMap { count := 0 var data []LineMap fileString := XMLParse.GetFileString(file) str := XMLParse.SplitToLines(fileString) _, LineContent := XMLParse.TrimToContentLines(str) data = make([]LineMap, len(LineContent)) pipe := make(chan LineMap, len(LineContent)) for n, m := range LineContent { l := LineMap{Line{n, m}, nil} go getDataMap(l, pipe) } for count < len(LineContent) { x := <-pipe data[x.Line.Number] = x count++ } return data }
func GetDataFieldFromFile(file, field string) []string { count := 0 var data []string fileString := XMLParse.GetFileString(file) str := XMLParse.SplitToLines(fileString) _, LineContent := XMLParse.TrimToContentLines(str) Elements := len(LineContent) data = make([]string, Elements) pipe := make(chan LineMap, Elements) go spawner(LineContent, pipe) for count < len(LineContent) { x := <-pipe i := x.Content[field] if i == "" { data[x.Line.Number] = "empty" } else { data[x.Line.Number] = i } count++ } return data }