Добавлено отслеживание изменений в конфиге. Посмотрим как будет работать

This commit is contained in:
B4D_US3R 2025-04-30 10:19:33 +05:00
parent 1de14cdae1
commit 66afe8eac7
5 changed files with 55 additions and 3 deletions

View file

@ -0,0 +1,30 @@
package file_watcher
import (
"os"
"time"
)
func IsFileChange(lastMod *time.Time, filename string) bool {
fileStat, err := os.Stat(filename)
if err != nil {
return false
}
if *lastMod != fileStat.ModTime() {
*lastMod = fileStat.ModTime()
return true
} else {
return false
}
}
func GetFileModTime(filename string) (time.Time, error) {
fileStat, err := os.Stat(filename)
if err != nil {
return time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC), err
}
return fileStat.ModTime(), nil
}

3
file_watcher/go.mod Normal file
View file

@ -0,0 +1,3 @@
module file_watcher
go 1.24.2