code: func WriteArchive(name string, files []string) (err error) {
  	archfd, err := os.Create(name)
  	if err != nil {
  		return err
  	}
  
  	defer func() {
  		archfd.Close()
  		// Remove the half-written archive on failure.
  		if err != nil {
  			os.Remove(name)
  		}
  	}()
  	archive, basename := NewArchive(archfd)
  	if archive == nil {
  		return fmt.Errorf("unknown archive extension")
  	}
  	fmt.Println(name)
  	if err := archive.Directory(basename); err != nil {
  		return err
  	}
  	for _, file := range files {
  		fmt.Println("   +", filepath.Base(file))
  		if err := AddFile(archive, file); err != nil {
  			return err
  		}
  	}
  	return archive.Close()
  }
docs: // WriteArchive creates an archive containing the given files.