diff options
author | Michael Muré <michael.mure@consensys.net> | 2018-11-21 18:56:12 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-03-01 22:35:36 +0100 |
commit | feab9412dffe5772048aad29893c4cb01d566387 (patch) | |
tree | b7bc9751f2ebdf8d41f5621bbf372eaf7625c4b9 /misc/random_bugs | |
parent | 0aefae6fcca5786f2c898029c3d6282f760f2c63 (diff) | |
download | git-bug-feab9412dffe5772048aad29893c4cb01d566387.tar.gz |
WIP identity in git
Diffstat (limited to 'misc/random_bugs')
-rw-r--r-- | misc/random_bugs/create_random_bugs.go | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/misc/random_bugs/create_random_bugs.go b/misc/random_bugs/create_random_bugs.go index 8faee200..f30a9d8a 100644 --- a/misc/random_bugs/create_random_bugs.go +++ b/misc/random_bugs/create_random_bugs.go @@ -6,11 +6,12 @@ import ( "time" "github.com/MichaelMure/git-bug/bug" + "github.com/MichaelMure/git-bug/identity" "github.com/MichaelMure/git-bug/repository" "github.com/icrowley/fake" ) -type opsGenerator func(bug.Interface, bug.Person) +type opsGenerator func(bug.Interface, identity.Interface) type Options struct { BugNumber int @@ -136,18 +137,15 @@ func GenerateRandomOperationPacksWithSeed(packNumber int, opNumber int, seed int return result } -func person() bug.Person { - return bug.Person{ - Name: fake.FullName(), - Email: fake.EmailAddress(), - } +func person() identity.Interface { + return identity.NewBare(fake.FullName(), fake.EmailAddress()) } -var persons []bug.Person +var persons []identity.Interface -func randomPerson(personNumber int) bug.Person { +func randomPerson(personNumber int) identity.Interface { if len(persons) == 0 { - persons = make([]bug.Person, personNumber) + persons = make([]identity.Interface, personNumber) for i := range persons { persons[i] = person() } @@ -162,25 +160,25 @@ func paragraphs() string { return strings.Replace(p, "\t", "\n\n", -1) } -func comment(b bug.Interface, p bug.Person) { +func comment(b bug.Interface, p identity.Interface) { _, _ = bug.AddComment(b, p, time.Now().Unix(), paragraphs()) } -func title(b bug.Interface, p bug.Person) { +func title(b bug.Interface, p identity.Interface) { _, _ = bug.SetTitle(b, p, time.Now().Unix(), fake.Sentence()) } -func open(b bug.Interface, p bug.Person) { +func open(b bug.Interface, p identity.Interface) { _, _ = bug.Open(b, p, time.Now().Unix()) } -func close(b bug.Interface, p bug.Person) { +func close(b bug.Interface, p identity.Interface) { _, _ = bug.Close(b, p, time.Now().Unix()) } var addedLabels []string -func labels(b bug.Interface, p bug.Person) { +func labels(b bug.Interface, p identity.Interface) { var removed []string nbRemoved := rand.Intn(3) for nbRemoved > 0 && len(addedLabels) > 0 { |