Replace specific error keys with the generic template:
- common.error.working_dir -> common.error.failed + Action
- common.error.load_config -> common.error.failed + Action
- common.error.build_failed -> common.error.failed + Action
- common.error.get_logs -> common.error.failed + Action
- common.error.tests_failed -> common.error.failed + Action
This reduces 5 duplicate error keys to 1 reusable template:
"Failed to {{.Action}}"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
25 lines
626 B
Go
25 lines
626 B
Go
package ci
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/host-uk/core/pkg/i18n"
|
|
"github.com/host-uk/core/pkg/release"
|
|
)
|
|
|
|
// runCIReleaseVersion shows the determined version.
|
|
func runCIReleaseVersion() error {
|
|
projectDir, err := os.Getwd()
|
|
if err != nil {
|
|
return fmt.Errorf("%s: %w", i18n.T("common.error.failed", map[string]any{"Action": "get working directory"}), err)
|
|
}
|
|
|
|
version, err := release.DetermineVersion(projectDir)
|
|
if err != nil {
|
|
return fmt.Errorf("%s: %w", i18n.T("cmd.ci.error.determine_version"), err)
|
|
}
|
|
|
|
fmt.Printf("%s %s\n", i18n.T("common.label.version"), releaseValueStyle.Render(version))
|
|
return nil
|
|
}
|