Skip to content

Commit 90842d2

Browse files
committed
Improve the error logging.
1 parent 1620093 commit 90842d2

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

cmd/services/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func main() {
9696

9797
err := app.Run(os.Args)
9898
if err != nil {
99-
log.Fatal(err)
99+
log.Fatalf("%v", err)
100100
}
101101
}
102102

pkg/cache/local_cache.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ func (l *LocalCache) CommitAndPushBranch(ctx context.Context, repoURL, branch, m
132132
if err != nil {
133133
return fmt.Errorf("failed to create a WorkTree: %w", err)
134134
}
135-
// TODO: provide credentials.
136135
_, err = w.Commit(message, &git.CommitOptions{
137136
Author: &object.Signature{
138137
Name: l.credentials.name,

pkg/promote/promote.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ func PromoteService(cache cache.GitCache, token, service, fromEnv, toEnv, newBra
3838
fileToUpdate := pathForService(service)
3939
newBody, err := cache.ReadFileFromBranch(ctx, fromURL, fileToUpdate, "master")
4040
if err != nil {
41-
return fmt.Errorf("failed to read the file %v from the %v environment: %s", fileToUpdate, fromEnv, err)
41+
return fmt.Errorf("failed to read the file %v from the %v environment: %v", fileToUpdate, fromEnv, err)
4242
}
4343
err = cache.CreateAndCheckoutBranch(ctx, toURL, "master", newBranchName)
4444
if err != nil {
45-
return fmt.Errorf("failed to create and checkout the new branch %v for the %v environment: %s", newBranchName, toEnv, err)
45+
return fmt.Errorf("failed to create and checkout the new branch %v for the %v environment: %v", newBranchName, toEnv, err)
4646
}
4747
err = cache.WriteFileToBranchAndStage(ctx, toURL, newBranchName, fileToUpdate, newBody)
4848
if err != nil {
49-
return fmt.Errorf("failed to write the updated file to %v: %s", fileToUpdate, err)
49+
return fmt.Errorf("failed to write the updated file to %v: %v", fileToUpdate, err)
5050
}
5151

5252
err = cache.CommitAndPushBranch(ctx, toURL, newBranchName, "this is a test commit", token)
5353
if err != nil {
54-
return fmt.Errorf("failed to commit and push branch for environment %v: %s", toEnv, err)
54+
return fmt.Errorf("failed to commit and push branch for environment %v: %v", toEnv, err)
5555
}
5656

5757
pr, err := createPullRequest(ctx, fromEnv, fromURL, toEnv, toURL, token, newBranchName)

0 commit comments

Comments
 (0)