Skip to content

Commit

Permalink
Fix outdated callsites in error strings
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Feb 16, 2024
1 parent f393844 commit 2bd416a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/backup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (c *command) schedule(strategy configStrategy) error {
})

if err != nil {
return fmt.Errorf("addJob: error adding schedule %s: %w", config.BackupCronExpression, err)
return fmt.Errorf("schedule: error adding schedule %s: %w", config.BackupCronExpression, err)
}
c.logger.Info(fmt.Sprintf("Successfully scheduled backup %s with expression %s", config.source, config.BackupCronExpression))
if ok := checkCronSchedule(config.BackupCronExpression); !ok {
Expand Down
10 changes: 5 additions & 5 deletions cmd/backup/config_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func loadConfig(lookup envProxy) (*Config, error) {
func loadConfigFromEnvVars() (*Config, error) {
c, err := loadConfig(os.LookupEnv)
if err != nil {
return nil, fmt.Errorf("loadEnvVars: error loading config from environment: %w", err)
return nil, fmt.Errorf("loadConfigFromEnvVars: error loading config from environment: %w", err)
}
c.source = "from environment"
return c, nil
Expand All @@ -89,7 +89,7 @@ func loadConfigsFromEnvFiles(directory string) ([]*Config, error) {
if os.IsNotExist(err) {
return nil, err
}
return nil, fmt.Errorf("loadEnvFiles: failed to read files from env directory: %w", err)
return nil, fmt.Errorf("loadConfigsFromEnvFiles: failed to read files from env directory: %w", err)
}

configs := []*Config{}
Expand All @@ -100,11 +100,11 @@ func loadConfigsFromEnvFiles(directory string) ([]*Config, error) {
p := filepath.Join(directory, item.Name())
f, err := os.ReadFile(p)
if err != nil {
return nil, fmt.Errorf("loadEnvFiles: error reading %s: %w", item.Name(), err)
return nil, fmt.Errorf("loadConfigsFromEnvFiles: error reading %s: %w", item.Name(), err)
}
envFile, err := godotenv.Unmarshal(os.ExpandEnv(string(f)))
if err != nil {
return nil, fmt.Errorf("loadEnvFiles: error reading config file %s: %w", p, err)
return nil, fmt.Errorf("loadConfigsFromEnvFiles: error reading config file %s: %w", p, err)
}
lookup := func(key string) (string, bool) {
val, ok := envFile[key]
Expand All @@ -115,7 +115,7 @@ func loadConfigsFromEnvFiles(directory string) ([]*Config, error) {
}
c, err := loadConfig(lookup)
if err != nil {
return nil, fmt.Errorf("loadEnvFiles: error loading config from file %s: %w", p, err)
return nil, fmt.Errorf("loadConfigsFromEnvFiles: error loading config from file %s: %w", p, err)
}
c.source = item.Name()
c.additionalEnvVars = envFile
Expand Down
4 changes: 2 additions & 2 deletions cmd/backup/stop_restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func awaitContainerCountForService(cli *client.Client, serviceID string, count i
select {
case <-timeout.C:
return fmt.Errorf(
"awaitContainerCount: timed out after waiting %s for service %s to reach desired container count of %d",
"awaitContainerCountForService: timed out after waiting %s for service %s to reach desired container count of %d",
timeoutAfter,
serviceID,
count,
Expand All @@ -65,7 +65,7 @@ func awaitContainerCountForService(cli *client.Client, serviceID string, count i
}),
})
if err != nil {
return fmt.Errorf("awaitContainerCount: error listing containers: %w", err)
return fmt.Errorf("awaitContainerCountForService: error listing containers: %w", err)
}
if len(containers) == count {
return nil
Expand Down

0 comments on commit 2bd416a

Please sign in to comment.