code: func copyFile(src, dst string, perm os.FileMode) error {
  	in, err := ioutil.ReadFile(src)
  	if err != nil {
  		return err
  	}
  
  	out, err := ioutil.ReadFile(dst)
  	if err != nil {
  		// The destination probably doesn't exist, we should create
  		// it.
  		goto copy
  	}
  
  	if bytes.Equal(in, out) {
  		// The permission bits may have changed without the contents
  		// changing so we always mirror them.
  		os.Chmod(dst, perm)
  		return nil
  	}
  
  copy:
  	os.MkdirAll(filepath.Dir(dst), 0777)
  	if err := ioutil.WriteFile(dst, in, perm); err != nil {
  		return err
  	}
  
  	return nil
  }
docs: // copyFile copies a file from src to dst, ensuring the containing directory
  // exists. The permission bits are copied as well. If dst already exists and
  // the contents are identical to src the modification time is not updated.