The := err shadows the previous err, so the panic in line 31 doesn't work. Also testing for err == nil is the other way round, the logfile needs to be created if there is an error with Stat(). Otherwise the logging does only work if there is a logfile already.
The := err shadows the previous err, so the panic in line 31 doesn't work. Also testing for err == nil is the other way round, the logfile needs to be created if there is an error with Stat(). Otherwise the logging does only work if there is a logfile already.