1
0
mirror of https://github.com/golang/go synced 2024-11-26 03:37:57 -07:00

archive/zip: document handling of duplicate names in Writer.Create

Fixes #66810

Change-Id: I6a7848dce245ae14941d61d2f78abaf0dc5c1247
Reviewed-on: https://go-review.googlesource.com/c/go/+/597978
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Sean Liao 2024-07-12 20:51:45 +01:00 committed by Gopher Robot
parent 6b97448132
commit 5c7f541386

View File

@ -213,7 +213,8 @@ func (w *Writer) Close() error {
// The name must be a relative path: it must not start with a drive // The name must be a relative path: it must not start with a drive
// letter (e.g. C:) or leading slash, and only forward slashes are // letter (e.g. C:) or leading slash, and only forward slashes are
// allowed. To create a directory instead of a file, add a trailing // allowed. To create a directory instead of a file, add a trailing
// slash to the name. // slash to the name. Duplicate names will not overwrite previous entries
// and are appended to the zip file.
// The file's contents must be written to the [io.Writer] before the next // The file's contents must be written to the [io.Writer] before the next
// call to [Writer.Create], [Writer.CreateHeader], or [Writer.Close]. // call to [Writer.Create], [Writer.CreateHeader], or [Writer.Close].
func (w *Writer) Create(name string) (io.Writer, error) { func (w *Writer) Create(name string) (io.Writer, error) {