package main import ( "bufio" "log" "os" ) func readWordlist(wordlistPath string) ([]string, error) { file, err := os.Open(wordlistPath) if err != nil { return nil, err } defer file.Close() scanner := bufio.NewScanner(file) scanner.Split(bufio.ScanLines) var lines []string for scanner.Scan() { lines = append(lines, scanner.Text()) } // return the lines, the line count and no error return lines, nil } func writeWordlistToChannel(wordlistChannel chan string, wordlist []string) { // write all the words from the wordlist into the wordlistChannel for _, line := range wordlist { wordlistChannel <- line } log.Printf("%s Done inserting the wordlist elements into the wordlist channel", green("[+]")) }