diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-01-07 10:33:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 21:33:17 -0500 |
commit | a1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd (patch) | |
tree | 7add88555600d96deecbc9f97217d183f83f3edc /build | |
parent | 21ed4fd8da4c8992518dcfb01aa7306f7406f735 (diff) | |
download | gitea-a1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd.tar.gz gitea-a1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd.zip |
Don't store assets modified time into generated files (#18193)
Diffstat (limited to 'build')
-rw-r--r-- | build/generate-bindata.go | 15 |
1 files changed, 10 insertions, 5 deletions
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) |