$Go typing practice

Practice typing Go (Golang) functions with short variable declarations, paired return values, and explicit error checks.

Start practice

Practice example

func read(p string) ([]byte, error) {
    data, err := os.ReadFile(p)
    if err != nil {
        return nil, err
    }
    return data, nil
}
data, err :=
Keep the comma and space in the pair, then type the colon before the equals sign.
if err != nil {
Type the exclamation mark and equals sign together. Practice the opening brace on the same line as the condition.

To type this example, paste it into Your code.