MCPcopy
hub / github.com/syncthing/syncthing / shouldRebuildAssets

Function shouldRebuildAssets

build.go:814–838  ·  view source on GitHub ↗
(target, srcdir string)

Source from the content-addressed store, hash-verified

812}
813
814func shouldRebuildAssets(target, srcdir string) bool {
815 info, err := os.Stat(target)
816 if err != nil {
817 // If the file doesn't exist, we must rebuild it
818 return true
819 }
820
821 // Check if any of the files in gui/ are newer than the asset file. If
822 // so we should rebuild it.
823 currentBuild := info.ModTime()
824 assetsAreNewer := false
825 stop := errors.New("no need to iterate further")
826 filepath.Walk(srcdir, func(path string, info os.FileInfo, err error) error {
827 if err != nil {
828 return err
829 }
830 if info.ModTime().After(currentBuild) {
831 assetsAreNewer = true
832 return stop
833 }
834 return nil
835 })
836
837 return assetsAreNewer
838}
839
840func updateDependencies() {
841 // Figure out desired Go version

Callers 1

lazyRebuildAssetsFunction · 0.85

Calls 4

StatMethod · 0.65
ModTimeMethod · 0.65
NewMethod · 0.65
WalkMethod · 0.65

Tested by

no test coverage detected