How to remove all line breaks from a string in Golang?

Removing all line breaks from a string results in the string being displayed in one line.
Remove Line Breaks

Example

// Golang program to remove
// line breaks from string
package main

import (
	"fmt"
	"strings"
)

func main() {

	x := "Hello \nWorld!"
	x = strings.Replace(x, "\n", "", -1)
	fmt.Println(x)
}

Output

Hello, World !

Most Helpful This Week