You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
279 B

  1. package main
  2. import (
  3. "io/ioutil"
  4. "strings"
  5. )
  6. func readTxt(path string) (string, error) {
  7. data, err := ioutil.ReadFile(path)
  8. if err != nil {
  9. //Do something
  10. }
  11. dataClean := strings.Replace(string(data), "\n", " ", -1)
  12. content := string(dataClean)
  13. return content, err
  14. }