Today I Learned

hashrocket A Hashrocket project

Create a string with a null byte

Use \x00

package main

import (
    "fmt"
)

func main() {
    fmt.Println([]byte("\x00"))
}

=> [0]

Escaping 0 will NOT work:

nul := "\0"
=> invalid character '"' in octal escape
See More #go TILs