package main import ( "strings" "fmt" ) func main() { s := "Some string with \n\t whitespace" fmt.Println(strings.Join(strings.Fields(s),"")) }