Skip to content

Commit 397c13b

Browse files
authored
chore: Minor code cleanup (#61)
1 parent 3b157f7 commit 397c13b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

eppoclient/config.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import (
88
"go.uber.org/zap"
99
)
1010

11-
const default_base_url = "https://fscdn.eppo.cloud/api"
11+
const defaultBaseUrl = "https://fscdn.eppo.cloud/api"
12+
const defaultPollerInterval = 10 * time.Second
1213

1314
type Config struct {
1415
BaseUrl string
@@ -24,15 +25,18 @@ func (cfg *Config) validate() error {
2425
}
2526

2627
if cfg.BaseUrl == "" {
27-
cfg.BaseUrl = default_base_url
28+
cfg.BaseUrl = defaultBaseUrl
2829
}
2930

3031
if cfg.PollerInterval <= 0 {
31-
cfg.PollerInterval = 10 * time.Second
32+
cfg.PollerInterval = defaultPollerInterval
3233
}
3334

3435
if cfg.ApplicationLogger == nil {
35-
defaultLogger, _ := zap.NewProduction()
36+
defaultLogger, err := zap.NewProduction(zap.IncreaseLevel(zap.WarnLevel))
37+
if err != nil {
38+
return fmt.Errorf("failed to create default logger: %v", err)
39+
}
3640
cfg.ApplicationLogger = applicationlogger.NewZapLogger(defaultLogger)
3741
}
3842

eppoclient/configresponse.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ type flagConfiguration struct {
2222
TotalShards int64 `json:"totalShards"`
2323
}
2424

25-
func (f *flagConfiguration) Precompute() {
26-
for i := range f.Allocations {
27-
f.Allocations[i].Precompute()
25+
func (flag *flagConfiguration) Precompute() {
26+
for i := range flag.Allocations {
27+
flag.Allocations[i].Precompute()
2828
}
2929
}
3030

0 commit comments

Comments
 (0)