Remove duplicate whitespace

yourbasic.org/golang
space := regexp.MustCompile(`\s+`)
s := space.ReplaceAllString("Hello  \t \n world!", " ")
fmt.Printf("%q", s) // "Hello world!"

\s+ is a regular expression:

In other words, the code will replace each whitespace substring with a single space character.

Further reading

Regular expressions is a gentle introduction to the regexp package with cheat sheet and plenty of examples.