Currently, to represent a newline in go programs, I use \n
. For example:
package main
import "fmt"
func main() {
fmt.Printf("%d is %s \n", 'U', string(85))
}
... will yield 85 is U
followed by a newline.
However, this doesn't seem all that cross-platform. Looking at other languages, PHP represents this with a global constant ( PHP_EOL
). Is \n
the right way to represent newlines in a cross-platform specific manner in go / golang?