-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.
Description
Go version
go version go1.25.4 X:nodwarf5 linux/amd64
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/vb/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/vb/.config/go/env'
GOEXE=''
GOEXPERIMENT='nodwarf5'
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1923640358=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/vb/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/vb/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/vb/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.4 X:nodwarf5'
GOWORK='/home/vb/code/dm/go/go.work'
PKG_CONFIG='pkg-config'What did you do?
Used CreateRaw to add a raw (aka already compressed) entry to a zip file
zipWriter := zip.NewWriter(w)
defer func() {
e = errors.Join(e, zipWriter.Close())
}()
// Create ZIP entry header
header := &zip.FileHeader{
Name: entryName,
Method: zip.Deflate,
CRC32: crc32,
CompressedSize64: uint64(deflateSize),
UncompressedSize64: uint64(uncompressedSize),
}
// Deprecated, but we have no other choice to set the zip file
// modified. Setting the Modified field does not work with
// CreateRaw! https://github.com/golang/go/issues/76741
header.SetModTime(stat.ModTime())
// Create writer for this entry
entryWriter, err := zipWriter.CreateRaw(header)
if err != nil {
return err
}I was expecting that putting the Modified field in FileHeader would set the timestamp of the entry.
Unfortunately I must use the deprecated function SetModTife here in order set the timestamp.
What did you see happen?
Setting the Modified field in FileHeader should set the entry timestamp like it happen for entries created by CreateHeader
What did you expect to see?
the Modified field in FileHeader should be honored
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.