package file import ( "bufio" "os" "strings" ) // Get the pipe func Pipe() []string { // Store lines var lines []string // Get pipe pipe, _ := os.Stdin.Stat() // Pipe found if (pipe.Mode() & os.ModeCharDevice) == 0 { // Create scanner scanner := bufio.NewScanner(os.Stdin) // Go through scanner for scanner.Scan() { // Store line line := scanner.Text() // Ignore empty & commented lines if line != "" && !strings.HasPrefix(line, "#") { lines = append(lines, strings.ToLower(line)) } } } return lines }