反引号 '`' 在需要保留格式时使用,原样输出

反引号里面的内容不能转义,可以换行,一般用于SQL语句,html等大段内容,以及正则表达式的使用

package main

import (
	"fmt"
)

func main() {
	str1 := `hello  world\n` // 不对内容转义,原样输出\n
	str2 := "hello world\n"  // 对内容转义,输出换行
    str3 := `hello 
	world \n`
	fmt.Println("str1: ", str1)
	fmt.Println("str2: ", str2)
    fmt.Println("str3: ", str3)
}

/*
    输出结果:
    str1: hello  world\n
    
    str2: hello world
    
    str3: hello
    world\n
*/