From a1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 7 Jan 2022 10:33:17 +0800 Subject: Don't store assets modified time into generated files (#18193) --- build/generate-bindata.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'build') diff --git a/build/generate-bindata.go b/build/generate-bindata.go index 477139d67b..7941af60a1 100644 --- a/build/generate-bindata.go +++ b/build/generate-bindata.go @@ -58,11 +58,15 @@ func needsUpdate(dir string, filename string) (bool, []byte) { } func main() { - if len(os.Args) != 4 { + if len(os.Args) < 4 { log.Fatal("Insufficient number of arguments. Need: directory packageName filename") } dir, packageName, filename := os.Args[1], os.Args[2], os.Args[3] + var useGlobalModTime bool + if len(os.Args) == 5 { + useGlobalModTime, _ = strconv.ParseBool(os.Args[4]) + } update, newHash := needsUpdate(dir, filename) @@ -74,10 +78,11 @@ func main() { fmt.Printf("generating bindata for %s\n", packageName) var fsTemplates http.FileSystem = http.Dir(dir) err := vfsgen.Generate(fsTemplates, vfsgen.Options{ - PackageName: packageName, - BuildTags: "bindata", - VariableName: "Assets", - Filename: filename, + PackageName: packageName, + BuildTags: "bindata", + VariableName: "Assets", + Filename: filename, + UseGlobalModTime: useGlobalModTime, }) if err != nil { log.Fatalf("%v\n", err) -- cgit v1.2.3