code: func (a ChmodAdapter) WriteHeader(hdr *tar.Header) error {
  	if hdr.FileInfo().Mode()&os.ModeSymlink == 0 {
  		newMode := hdr.Mode &^ 0777
  		if hdr.FileInfo().IsDir() {
  			newMode |= a.NewDirMode
  		} else if hdr.FileInfo().Mode()&0010 != 0 { // S_IXUSR
  			newMode |= a.NewExecFileMode
  		} else {
  			newMode |= a.NewFileMode
  		}
  		hdr.Mode = newMode
  	}
  	return a.Writer.WriteHeader(hdr)
  }
docs: // WriteHeader changes the mode of files and directories inline as a tarfile is
  // being written