@@ -13,7 +13,7 @@ import (
13
13
// RepoUpdater creates branches proposing all available updates for a Go module.
14
14
type RepoUpdater struct {
15
15
repo Repo
16
- updater Updater
16
+ Updater Updater
17
17
groups Groups
18
18
branchNamer UpdateBranchNamer
19
19
}
@@ -39,6 +39,7 @@ type Repo interface {
39
39
}
40
40
41
41
type Updater interface {
42
+ Name () string
42
43
Dependencies (context.Context ) ([]Dependency , error )
43
44
Check (ctx context.Context , dep Dependency , filter func (string ) bool ) (* Update , error )
44
45
ApplyUpdate (context.Context , Update ) error
@@ -53,7 +54,7 @@ type Factory interface {
53
54
func NewRepoUpdater (repo Repo , updater Updater , opts ... RepoUpdaterOpt ) * RepoUpdater {
54
55
u := & RepoUpdater {
55
56
repo : repo ,
56
- updater : updater ,
57
+ Updater : updater ,
57
58
branchNamer : DefaultUpdateBranchNamer {},
58
59
}
59
60
for _ , opt := range opts {
@@ -82,7 +83,7 @@ func (u *RepoUpdater) Update(ctx context.Context, baseBranch, branchName string,
82
83
return fmt .Errorf ("switching to target branch: %w" , err )
83
84
}
84
85
for _ , update := range updates .Updates {
85
- if err := u .updater .ApplyUpdate (ctx , update ); err != nil {
86
+ if err := u .Updater .ApplyUpdate (ctx , update ); err != nil {
86
87
return fmt .Errorf ("applying update: %w" , err )
87
88
}
88
89
}
@@ -117,7 +118,7 @@ func (u *RepoUpdater) updateBranch(ctx context.Context, log logrus.FieldLogger,
117
118
}
118
119
119
120
// List dependencies while on this branch:
120
- deps , err := u .updater .Dependencies (ctx )
121
+ deps , err := u .Updater .Dependencies (ctx )
121
122
if err != nil {
122
123
return fmt .Errorf ("getting dependencies: %w" , err )
123
124
}
@@ -183,7 +184,7 @@ func (u *RepoUpdater) updateBranch(ctx context.Context, log logrus.FieldLogger,
183
184
}
184
185
185
186
func (u * RepoUpdater ) checkForUpdate (ctx context.Context , log logrus.FieldLogger , dep Dependency , filter func (string ) bool ) * Update {
186
- update , err := u .updater .Check (ctx , dep , filter )
187
+ update , err := u .Updater .Check (ctx , dep , filter )
187
188
if err != nil {
188
189
log .WithError (err ).Warn ("error checking for updates" )
189
190
return nil
@@ -209,7 +210,7 @@ func (u *RepoUpdater) singleUpdate(ctx context.Context, log logrus.FieldLogger,
209
210
if err := u .repo .NewBranch (baseBranch , branch ); err != nil {
210
211
return false , fmt .Errorf ("switching to target branch: %w" , err )
211
212
}
212
- if err := u .updater .ApplyUpdate (ctx , * update ); err != nil {
213
+ if err := u .Updater .ApplyUpdate (ctx , * update ); err != nil {
213
214
return false , fmt .Errorf ("applying batched update: %w" , err )
214
215
}
215
216
@@ -254,7 +255,7 @@ func (u *RepoUpdater) groupedUpdate(ctx context.Context, log logrus.FieldLogger,
254
255
}
255
256
256
257
for _ , update := range updates {
257
- if err := u .updater .ApplyUpdate (ctx , update ); err != nil {
258
+ if err := u .Updater .ApplyUpdate (ctx , update ); err != nil {
258
259
return 0 , fmt .Errorf ("applying batched update: %w" , err )
259
260
}
260
261
}
0 commit comments