diff options
| -rw-r--r-- | android/fixture.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/android/fixture.go b/android/fixture.go index 2c8997bd2..2085e43ed 100644 --- a/android/fixture.go +++ b/android/fixture.go @@ -564,7 +564,11 @@ type fixtureFactory struct { } func (f *fixtureFactory) Extend(preparers ...FixturePreparer) FixtureFactory { - all := append(f.preparers, dedupAndFlattenPreparers(f.preparers, preparers)...) + // Create a new slice to avoid accidentally sharing the preparers slice from this factory with + // the extending factories. + var all []*simpleFixturePreparer + all = append(all, f.preparers...) + all = append(all, dedupAndFlattenPreparers(f.preparers, preparers)...) // Copy the existing factory. extendedFactory := &fixtureFactory{} *extendedFactory = *f |