oz / tz

🌐 A time zone helper
GNU General Public License v3.0
851 stars 33 forks source link

Crash: SIGSEGV: segmentation violation (config-related) #65

Closed jnd-au closed 1 month ago

jnd-au commented 1 month ago

Config now relies on a Logger (since 88dec44), but the Logger is not initialised for Unit Testing (SetupLogger), causing the following failure when writing unit tests involving configuration:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104615e50]

goroutine 14 [running]:
testing.tRunner.func1.2({0x1046e2ee0, 0x104892040})
        ./go/1.23.2/libexec/src/testing/testing.go:1632 +0x1bc
testing.tRunner.func1()
        ./go/1.23.2/libexec/src/testing/testing.go:1635 +0x334
panic({0x1046e2ee0?, 0x104892040?})
        ./go/1.23.2/libexec/src/runtime/panic.go:785 +0x124
log.(*Logger).output(0x14000019200?, 0x21?, 0x14000104488?, 0x1045190f4?)
        ./go/1.23.2/libexec/src/log/log.go:203 +0x30
log.(*Logger).Printf(...)
        ./go/1.23.2/libexec/src/log/log.go:268
github.com/oz/tz.LoadConfigFile()
        ./tz/config_file.go:999 +0x280

Furthermore, the configuration behaviour was added to tz without unit tests.