code: func Download(ctx context.Context, c *http.Client, src, dst string) (err error) {
  	// Log
  	astilog.Debugf("Downloading %s into %s", src, dst)
  
  	// Destination already exists
  	if _, err = os.Stat(dst); err == nil {
  		astilog.Debugf("%s already exists, skipping download...", dst)
  		return
  	} else if !os.IsNotExist(err) {
  		return errors.Wrapf(err, "stating %s failed", dst)
  	}
  	err = nil
  
  	// Clean up on error
  	defer func(err *error) {
  		if *err != nil || ctx.Err() != nil {
  			astilog.Debugf("Removing %s...", dst)
  			os.Remove(dst)
  		}
  	}(&err)
  
  	// Make sure the dst directory  exists
  	if err = os.MkdirAll(filepath.Dir(dst), 0775); err != nil {
  		return errors.Wrapf(err, "mkdirall %s failed", filepath.Dir(dst))
  	}
  
  	// Download
  	if err = astihttp.Download(ctx, c, src, dst); err != nil {
  		return errors.Wrap(err, "astihttp.Download failed")
  	}
  	return
  }
docs: // Download is a cancellable function that downloads a src into a dst using a specific *http.Client and cleans up on
  // failed downloads