You have to use named return parameter here in order for your deferred calls to work properly. 
```Go
func copyDiskImage(dst, src string) ) (err error) {...}
```

Try this example to understand why
```Go
package main

import (
	"errors"
	"log"
)

func main() {
	log.Println(f(), g())
}

func f() error {
	var err error
	defer func() {
		err = errors.New("error")
	}()
	return nil
}

func g() (err error) {
	defer func() {
		err = errors.New("error")
	}()
	return nil
}
```