Skip to content

embed: modification time not set for embedded files #44854

@eudore

Description

@eudore

What version of Go are you using (go version)?

$ go version
go version go1.16 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env GOARCH GOOS
amd64
linux

What did you do?

package main

import (
	"embed"
	"fmt"
)

//go:embed static
var f embed.FS

func main() {
	f, err := f.Open("static/server.html")
	if err != nil {
		fmt.Println(err)
		return
	}
	stat, err := f.Stat()
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(stat.ModTime())
}

What did you expect to see?

2021-03-08 11:03:38 +0800 CST

What did you see instead?

0001-01-01 00:00:00 +0000 UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions