1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-23 00:55:58 +01:00

Fix typo in GetConfiguration.

This commit is contained in:
Juliusz Chroboczek 2021-10-31 22:39:35 +01:00
parent b91d48d4ea
commit 3e52ac1253

View file

@ -819,6 +819,11 @@ type Configuration struct {
Admin []ClientPattern `json:"admin"` Admin []ClientPattern `json:"admin"`
} }
func (conf Configuration) Zero() bool {
return conf.modTime.Equal(time.Time{}) &&
conf.fileSize == 0
}
var configuration struct { var configuration struct {
mu sync.Mutex mu sync.Mutex
configuration *Configuration configuration *Configuration
@ -836,12 +841,10 @@ func GetConfiguration() (*Configuration, error) {
fi, err := os.Stat(filename) fi, err := os.Stat(filename)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
if !configuration.configuration.modTime.Equal( if !configuration.configuration.Zero() {
time.Time{},
) {
configuration.configuration = &Configuration{} configuration.configuration = &Configuration{}
return configuration.configuration, nil
} }
return configuration.configuration, nil
} }
return nil, err return nil, err
} }