package main

import (
	"errors"
	"fmt"
)

func main() {
	var err error
	err = errors.New("this is an error")
	if err != nil {
		fmt.Println(err.Error())
	}
	if true {
		err := newError()
		defer func() {
			if err != nil {
				fmt.Println(err.Error(), "1")
			}
		}()
	}

	err = errors.New("this is another error")
	if err != nil {
		fmt.Println(err.Error())
	}
}

func newError() error {
	var err error
	return err
}
