From 12902dc18a98b7ff77a749fbbc05bb4654820a17 Mon Sep 17 00:00:00 2001 From: Christopher Hunter Date: Thu, 31 Aug 2023 10:53:26 -0700 Subject: [PATCH] fix: move notes fakes to internal package there was a problem with the generate statements --- pkg/notes/internal/fakes/historic_kilnfile.go | 14 +++++++------- pkg/notes/internal/fakes/historic_version.go | 14 +++++++------- pkg/notes/internal/fakes/issue_getter.go | 14 +++++++------- .../internal/fakes/issues_by_repo_lister.go | 14 +++++++------- pkg/notes/internal/fakes/issues_service.go | 18 +++++++++--------- pkg/notes/internal/fakes/milestone_lister.go | 14 +++++++------- pkg/notes/internal/fakes/releases_service.go | 14 +++++++------- pkg/notes/internal/fakes/revision_resolver.go | 14 +++++++------- pkg/notes/notes_data.go | 16 ++++++++-------- 9 files changed, 66 insertions(+), 66 deletions(-) diff --git a/pkg/notes/internal/fakes/historic_kilnfile.go b/pkg/notes/internal/fakes/historic_kilnfile.go index d687dc660..8a05a0452 100644 --- a/pkg/notes/internal/fakes/historic_kilnfile.go +++ b/pkg/notes/internal/fakes/historic_kilnfile.go @@ -27,7 +27,7 @@ type HistoricKilnfile struct { result2 cargo.KilnfileLock result3 error } - invocations map[string][][]any + invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -41,7 +41,7 @@ func (fake *HistoricKilnfile) Spy(arg1 storer.EncodedObjectStorer, arg2 plumbing }{arg1, arg2, arg3}) stub := fake.Stub returns := fake.returns - fake.recordInvocation("historicKilnfile", []any{arg1, arg2, arg3}) + fake.recordInvocation("historicKilnfile", []interface{}{arg1, arg2, arg3}) fake.mutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3) @@ -99,26 +99,26 @@ func (fake *HistoricKilnfile) ReturnsOnCall(i int, result1 cargo.Kilnfile, resul }{result1, result2, result3} } -func (fake *HistoricKilnfile) Invocations() map[string][][]any { +func (fake *HistoricKilnfile) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.mutex.RLock() defer fake.mutex.RUnlock() - copiedInvocations := map[string][][]any{} + copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value } return copiedInvocations } -func (fake *HistoricKilnfile) recordInvocation(key string, args []any) { +func (fake *HistoricKilnfile) recordInvocation(key string, args []interface{}) { fake.invocationsMutex.Lock() defer fake.invocationsMutex.Unlock() if fake.invocations == nil { - fake.invocations = map[string][][]any{} + fake.invocations = map[string][][]interface{}{} } if fake.invocations[key] == nil { - fake.invocations[key] = [][]any{} + fake.invocations[key] = [][]interface{}{} } fake.invocations[key] = append(fake.invocations[key], args) } diff --git a/pkg/notes/internal/fakes/historic_version.go b/pkg/notes/internal/fakes/historic_version.go index deb321033..b3d47fb2e 100644 --- a/pkg/notes/internal/fakes/historic_version.go +++ b/pkg/notes/internal/fakes/historic_version.go @@ -24,7 +24,7 @@ type HistoricVersion struct { result1 string result2 error } - invocations map[string][][]any + invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -38,7 +38,7 @@ func (fake *HistoricVersion) Spy(arg1 storer.EncodedObjectStorer, arg2 plumbing. }{arg1, arg2, arg3}) stub := fake.Stub returns := fake.returns - fake.recordInvocation("historicVersion", []any{arg1, arg2, arg3}) + fake.recordInvocation("historicVersion", []interface{}{arg1, arg2, arg3}) fake.mutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3) @@ -93,26 +93,26 @@ func (fake *HistoricVersion) ReturnsOnCall(i int, result1 string, result2 error) }{result1, result2} } -func (fake *HistoricVersion) Invocations() map[string][][]any { +func (fake *HistoricVersion) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.mutex.RLock() defer fake.mutex.RUnlock() - copiedInvocations := map[string][][]any{} + copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value } return copiedInvocations } -func (fake *HistoricVersion) recordInvocation(key string, args []any) { +func (fake *HistoricVersion) recordInvocation(key string, args []interface{}) { fake.invocationsMutex.Lock() defer fake.invocationsMutex.Unlock() if fake.invocations == nil { - fake.invocations = map[string][][]any{} + fake.invocations = map[string][][]interface{}{} } if fake.invocations[key] == nil { - fake.invocations[key] = [][]any{} + fake.invocations[key] = [][]interface{}{} } fake.invocations[key] = append(fake.invocations[key], args) } diff --git a/pkg/notes/internal/fakes/issue_getter.go b/pkg/notes/internal/fakes/issue_getter.go index fcd0c6451..3dbaa90cc 100644 --- a/pkg/notes/internal/fakes/issue_getter.go +++ b/pkg/notes/internal/fakes/issue_getter.go @@ -27,7 +27,7 @@ type IssueGetter struct { result2 *github.Response result3 error } - invocations map[string][][]any + invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -42,7 +42,7 @@ func (fake *IssueGetter) Get(arg1 context.Context, arg2 string, arg3 string, arg }{arg1, arg2, arg3, arg4}) stub := fake.GetStub fakeReturns := fake.getReturns - fake.recordInvocation("Get", []any{arg1, arg2, arg3, arg4}) + fake.recordInvocation("Get", []interface{}{arg1, arg2, arg3, arg4}) fake.getMutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3, arg4) @@ -101,26 +101,26 @@ func (fake *IssueGetter) GetReturnsOnCall(i int, result1 *github.Issue, result2 }{result1, result2, result3} } -func (fake *IssueGetter) Invocations() map[string][][]any { +func (fake *IssueGetter) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.getMutex.RLock() defer fake.getMutex.RUnlock() - copiedInvocations := map[string][][]any{} + copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value } return copiedInvocations } -func (fake *IssueGetter) recordInvocation(key string, args []any) { +func (fake *IssueGetter) recordInvocation(key string, args []interface{}) { fake.invocationsMutex.Lock() defer fake.invocationsMutex.Unlock() if fake.invocations == nil { - fake.invocations = map[string][][]any{} + fake.invocations = map[string][][]interface{}{} } if fake.invocations[key] == nil { - fake.invocations[key] = [][]any{} + fake.invocations[key] = [][]interface{}{} } fake.invocations[key] = append(fake.invocations[key], args) } diff --git a/pkg/notes/internal/fakes/issues_by_repo_lister.go b/pkg/notes/internal/fakes/issues_by_repo_lister.go index af96733bd..f63c2368d 100644 --- a/pkg/notes/internal/fakes/issues_by_repo_lister.go +++ b/pkg/notes/internal/fakes/issues_by_repo_lister.go @@ -27,7 +27,7 @@ type IssuesByRepoLister struct { result2 *github.Response result3 error } - invocations map[string][][]any + invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -42,7 +42,7 @@ func (fake *IssuesByRepoLister) ListByRepo(arg1 context.Context, arg2 string, ar }{arg1, arg2, arg3, arg4}) stub := fake.ListByRepoStub fakeReturns := fake.listByRepoReturns - fake.recordInvocation("ListByRepo", []any{arg1, arg2, arg3, arg4}) + fake.recordInvocation("ListByRepo", []interface{}{arg1, arg2, arg3, arg4}) fake.listByRepoMutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3, arg4) @@ -101,26 +101,26 @@ func (fake *IssuesByRepoLister) ListByRepoReturnsOnCall(i int, result1 []*github }{result1, result2, result3} } -func (fake *IssuesByRepoLister) Invocations() map[string][][]any { +func (fake *IssuesByRepoLister) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.listByRepoMutex.RLock() defer fake.listByRepoMutex.RUnlock() - copiedInvocations := map[string][][]any{} + copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value } return copiedInvocations } -func (fake *IssuesByRepoLister) recordInvocation(key string, args []any) { +func (fake *IssuesByRepoLister) recordInvocation(key string, args []interface{}) { fake.invocationsMutex.Lock() defer fake.invocationsMutex.Unlock() if fake.invocations == nil { - fake.invocations = map[string][][]any{} + fake.invocations = map[string][][]interface{}{} } if fake.invocations[key] == nil { - fake.invocations[key] = [][]any{} + fake.invocations[key] = [][]interface{}{} } fake.invocations[key] = append(fake.invocations[key], args) } diff --git a/pkg/notes/internal/fakes/issues_service.go b/pkg/notes/internal/fakes/issues_service.go index 0b902787b..fb4af88f0 100644 --- a/pkg/notes/internal/fakes/issues_service.go +++ b/pkg/notes/internal/fakes/issues_service.go @@ -63,7 +63,7 @@ type IssuesService struct { result2 *github.Response result3 error } - invocations map[string][][]any + invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -78,7 +78,7 @@ func (fake *IssuesService) Get(arg1 context.Context, arg2 string, arg3 string, a }{arg1, arg2, arg3, arg4}) stub := fake.GetStub fakeReturns := fake.getReturns - fake.recordInvocation("Get", []any{arg1, arg2, arg3, arg4}) + fake.recordInvocation("Get", []interface{}{arg1, arg2, arg3, arg4}) fake.getMutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3, arg4) @@ -148,7 +148,7 @@ func (fake *IssuesService) ListByRepo(arg1 context.Context, arg2 string, arg3 st }{arg1, arg2, arg3, arg4}) stub := fake.ListByRepoStub fakeReturns := fake.listByRepoReturns - fake.recordInvocation("ListByRepo", []any{arg1, arg2, arg3, arg4}) + fake.recordInvocation("ListByRepo", []interface{}{arg1, arg2, arg3, arg4}) fake.listByRepoMutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3, arg4) @@ -218,7 +218,7 @@ func (fake *IssuesService) ListMilestones(arg1 context.Context, arg2 string, arg }{arg1, arg2, arg3, arg4}) stub := fake.ListMilestonesStub fakeReturns := fake.listMilestonesReturns - fake.recordInvocation("ListMilestones", []any{arg1, arg2, arg3, arg4}) + fake.recordInvocation("ListMilestones", []interface{}{arg1, arg2, arg3, arg4}) fake.listMilestonesMutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3, arg4) @@ -277,7 +277,7 @@ func (fake *IssuesService) ListMilestonesReturnsOnCall(i int, result1 []*github. }{result1, result2, result3} } -func (fake *IssuesService) Invocations() map[string][][]any { +func (fake *IssuesService) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.getMutex.RLock() @@ -286,21 +286,21 @@ func (fake *IssuesService) Invocations() map[string][][]any { defer fake.listByRepoMutex.RUnlock() fake.listMilestonesMutex.RLock() defer fake.listMilestonesMutex.RUnlock() - copiedInvocations := map[string][][]any{} + copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value } return copiedInvocations } -func (fake *IssuesService) recordInvocation(key string, args []any) { +func (fake *IssuesService) recordInvocation(key string, args []interface{}) { fake.invocationsMutex.Lock() defer fake.invocationsMutex.Unlock() if fake.invocations == nil { - fake.invocations = map[string][][]any{} + fake.invocations = map[string][][]interface{}{} } if fake.invocations[key] == nil { - fake.invocations[key] = [][]any{} + fake.invocations[key] = [][]interface{}{} } fake.invocations[key] = append(fake.invocations[key], args) } diff --git a/pkg/notes/internal/fakes/milestone_lister.go b/pkg/notes/internal/fakes/milestone_lister.go index ec4389a97..02d2c029d 100644 --- a/pkg/notes/internal/fakes/milestone_lister.go +++ b/pkg/notes/internal/fakes/milestone_lister.go @@ -27,7 +27,7 @@ type MilestoneLister struct { result2 *github.Response result3 error } - invocations map[string][][]any + invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -42,7 +42,7 @@ func (fake *MilestoneLister) ListMilestones(arg1 context.Context, arg2 string, a }{arg1, arg2, arg3, arg4}) stub := fake.ListMilestonesStub fakeReturns := fake.listMilestonesReturns - fake.recordInvocation("ListMilestones", []any{arg1, arg2, arg3, arg4}) + fake.recordInvocation("ListMilestones", []interface{}{arg1, arg2, arg3, arg4}) fake.listMilestonesMutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3, arg4) @@ -101,26 +101,26 @@ func (fake *MilestoneLister) ListMilestonesReturnsOnCall(i int, result1 []*githu }{result1, result2, result3} } -func (fake *MilestoneLister) Invocations() map[string][][]any { +func (fake *MilestoneLister) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.listMilestonesMutex.RLock() defer fake.listMilestonesMutex.RUnlock() - copiedInvocations := map[string][][]any{} + copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value } return copiedInvocations } -func (fake *MilestoneLister) recordInvocation(key string, args []any) { +func (fake *MilestoneLister) recordInvocation(key string, args []interface{}) { fake.invocationsMutex.Lock() defer fake.invocationsMutex.Unlock() if fake.invocations == nil { - fake.invocations = map[string][][]any{} + fake.invocations = map[string][][]interface{}{} } if fake.invocations[key] == nil { - fake.invocations[key] = [][]any{} + fake.invocations[key] = [][]interface{}{} } fake.invocations[key] = append(fake.invocations[key], args) } diff --git a/pkg/notes/internal/fakes/releases_service.go b/pkg/notes/internal/fakes/releases_service.go index f97492ca4..0d89fd752 100644 --- a/pkg/notes/internal/fakes/releases_service.go +++ b/pkg/notes/internal/fakes/releases_service.go @@ -28,7 +28,7 @@ type ReleaseService struct { result2 *github.Response result3 error } - invocations map[string][][]any + invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -43,7 +43,7 @@ func (fake *ReleaseService) ListReleases(arg1 context.Context, arg2 string, arg3 }{arg1, arg2, arg3, arg4}) stub := fake.ListReleasesStub fakeReturns := fake.listReleasesReturns - fake.recordInvocation("ListReleases", []any{arg1, arg2, arg3, arg4}) + fake.recordInvocation("ListReleases", []interface{}{arg1, arg2, arg3, arg4}) fake.listReleasesMutex.Unlock() if stub != nil { return stub(arg1, arg2, arg3, arg4) @@ -102,26 +102,26 @@ func (fake *ReleaseService) ListReleasesReturnsOnCall(i int, result1 []*github.R }{result1, result2, result3} } -func (fake *ReleaseService) Invocations() map[string][][]any { +func (fake *ReleaseService) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.listReleasesMutex.RLock() defer fake.listReleasesMutex.RUnlock() - copiedInvocations := map[string][][]any{} + copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value } return copiedInvocations } -func (fake *ReleaseService) recordInvocation(key string, args []any) { +func (fake *ReleaseService) recordInvocation(key string, args []interface{}) { fake.invocationsMutex.Lock() defer fake.invocationsMutex.Unlock() if fake.invocations == nil { - fake.invocations = map[string][][]any{} + fake.invocations = map[string][][]interface{}{} } if fake.invocations[key] == nil { - fake.invocations[key] = [][]any{} + fake.invocations[key] = [][]interface{}{} } fake.invocations[key] = append(fake.invocations[key], args) } diff --git a/pkg/notes/internal/fakes/revision_resolver.go b/pkg/notes/internal/fakes/revision_resolver.go index 5d0e54f9b..68269f21a 100644 --- a/pkg/notes/internal/fakes/revision_resolver.go +++ b/pkg/notes/internal/fakes/revision_resolver.go @@ -21,7 +21,7 @@ type RevisionResolver struct { result1 *plumbing.Hash result2 error } - invocations map[string][][]any + invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -33,7 +33,7 @@ func (fake *RevisionResolver) ResolveRevision(arg1 plumbing.Revision) (*plumbing }{arg1}) stub := fake.ResolveRevisionStub fakeReturns := fake.resolveRevisionReturns - fake.recordInvocation("ResolveRevision", []any{arg1}) + fake.recordInvocation("ResolveRevision", []interface{}{arg1}) fake.resolveRevisionMutex.Unlock() if stub != nil { return stub(arg1) @@ -89,26 +89,26 @@ func (fake *RevisionResolver) ResolveRevisionReturnsOnCall(i int, result1 *plumb }{result1, result2} } -func (fake *RevisionResolver) Invocations() map[string][][]any { +func (fake *RevisionResolver) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() fake.resolveRevisionMutex.RLock() defer fake.resolveRevisionMutex.RUnlock() - copiedInvocations := map[string][][]any{} + copiedInvocations := map[string][][]interface{}{} for key, value := range fake.invocations { copiedInvocations[key] = value } return copiedInvocations } -func (fake *RevisionResolver) recordInvocation(key string, args []any) { +func (fake *RevisionResolver) recordInvocation(key string, args []interface{}) { fake.invocationsMutex.Lock() defer fake.invocationsMutex.Unlock() if fake.invocations == nil { - fake.invocations = map[string][][]any{} + fake.invocations = map[string][][]interface{}{} } if fake.invocations[key] == nil { - fake.invocations[key] = [][]any{} + fake.invocations[key] = [][]interface{}{} } fake.invocations[key] = append(fake.invocations[key], args) } diff --git a/pkg/notes/notes_data.go b/pkg/notes/notes_data.go index cdadf6215..6d84b745d 100644 --- a/pkg/notes/notes_data.go +++ b/pkg/notes/notes_data.go @@ -269,15 +269,15 @@ func (r fetchNotesData) kilnfileFromWorktree(kilnfilePath string) (cargo.Kilnfil return wtKf, nil } -//counterfeiter:generate -o ./fakes/historic_version.go --fake-name HistoricVersion . historicVersion +//counterfeiter:generate -o ./internal/fakes/historic_version.go --fake-name HistoricVersion . historicVersion type historicVersion func(repo storer.EncodedObjectStorer, commitHash plumbing.Hash, kilnfilePath string) (string, error) -//counterfeiter:generate -o ./fakes/historic_kilnfile.go --fake-name HistoricKilnfile . historicKilnfile +//counterfeiter:generate -o ./internal/fakes/historic_kilnfile.go --fake-name HistoricKilnfile . historicKilnfile type historicKilnfile func(repo storer.EncodedObjectStorer, commitHash plumbing.Hash, kilnfilePath string) (cargo.Kilnfile, cargo.KilnfileLock, error) -//counterfeiter:generate -o ./fakes/revision_resolver.go --fake-name RevisionResolver . revisionResolver +//counterfeiter:generate -o ./internal/fakes/revision_resolver.go --fake-name RevisionResolver . revisionResolver type revisionResolver interface { ResolveRevision(rev plumbing.Revision) (*plumbing.Hash, error) @@ -314,8 +314,8 @@ func (r fetchNotesData) fetchHistoricFiles(kilnfilePath, start, end string) (klI return klInitial, klFinal, kfFinal, v, nil } -//counterfeiter:generate -o ./fakes/releases_service.go --fake-name ReleaseService github.com/pivotal-cf/kiln/pkg/cargo.RepositoryReleaseLister -//counterfeiter:generate -o ./fakes/issues_service.go --fake-name IssuesService . issuesService +//counterfeiter:generate -o ./internal/fakes/releases_service.go --fake-name ReleaseService github.com/pivotal-cf/kiln/pkg/cargo.RepositoryReleaseLister +//counterfeiter:generate -o ./internal/fakes/issues_service.go --fake-name IssuesService . issuesService type issuesService interface { issueGetter @@ -355,7 +355,7 @@ func (r fetchNotesData) fetchIssuesAndReleaseNotes(ctx context.Context, finalKF, return appendFilterAndSortIssues(issues, additionalIssues, issuesQuery.IssueTitleExp), bumpList, nil } -//counterfeiter:generate -o ./fakes/issue_getter.go --fake-name IssueGetter . issueGetter +//counterfeiter:generate -o ./internal/fakes/issue_getter.go --fake-name IssueGetter . issueGetter type issueGetter interface { Get(ctx context.Context, owner string, repo string, number int) (*github.Issue, *github.Response, error) @@ -380,7 +380,7 @@ func issuesFromIssueIDs(ctx context.Context, issuesService issueGetter, repoOwne return issues, nil } -//counterfeiter:generate -o ./fakes/milestone_lister.go --fake-name MilestoneLister . milestoneLister +//counterfeiter:generate -o ./internal/fakes/milestone_lister.go --fake-name MilestoneLister . milestoneLister type milestoneLister interface { ListMilestones(ctx context.Context, owner string, repo string, opts *github.MilestoneListOptions) ([]*github.Milestone, *github.Response, error) @@ -418,7 +418,7 @@ func resolveMilestoneNumber(ctx context.Context, issuesService milestoneLister, } } -//counterfeiter:generate -o ./fakes/issues_by_repo_lister.go --fake-name IssuesByRepoLister . issuesByRepoLister +//counterfeiter:generate -o ./internal/fakes/issues_by_repo_lister.go --fake-name IssuesByRepoLister . issuesByRepoLister type issuesByRepoLister interface { ListByRepo(ctx context.Context, owner string, repo string, opts *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error)