Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The ret variable is replaced with a struct literal that's returned at the end of the function. This avoids the need to declare and initialize the ret variable before the conditional logic that determines the location string. The location and numdays parameters are renamed to location and numDays, respectively, to match the standard Go naming convention for exported names. The getLocationString function is extracted to a separate function for readability and to avoid nesting multiple conditional blocks. The function returns an error if the location string cannot be determined. The parseCurrent and parseForecast functions are added as wrapper functions for the parseCond and parseDaily methods, respectively, for clarity and consistency with the iface interface. The log.Fatalf calls are simplified by removing the \n escape sequences and using the %v format verb instead of %s.
- Loading branch information