title: Go ReadString issues: The filename, directory name, or volume label syntax is incorrect
body: <p>can anyone figure this out? I think the problem might be in the readstring() argument when being passed to the create file function. I tried resolving it by stripping '\n' but the error remains. Is there a workaround other than readstring()? Because I think it's the one causing issues. Thank you </p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "bufio"
      "log"
      "strings"
      //"io/ioutil"
      "os"
  )
  
  func main() {
      fmt.Print("Enter filename to create: ")
  
      reader := bufio.NewReader(os.Stdin)
  
      text, _ := reader.ReadString('\n')
      text = strings.TrimSuffix(text, "\n")
  
  
      if len(text) &gt; 3 {
          //newFile, err := os.Create(text)
          fmt.Println("Name:"+text)
          createFile(text)
      } else {
          fmt.Println("invalid filename")
      }
  
  }
  
  func createFile(fileName string){
      var newFile *os.File
      var err error
  
  
      fmt.Println(fileName)
  
      newFile, err = os.Create(fileName)
      if err != nil {
          log.Fatal(err)
      }
      newFile.Close()
  }
  </code></pre>
  
  <hr>
  
  <p>Ok for those who are new to this problem, I've manage to find a workaround using scanf. So consider this problem solved. </p>