@@ -29,7 +29,7 @@ func TestMoq(t *testing.T) {
2929 }
3030 s := buf .String ()
3131 // assertions of things that should be mentioned
32- var strs = []string {
32+ strs : = []string {
3333 "package example" ,
3434 "type PersonStoreMock struct" ,
3535 "CreateFunc func(ctx context.Context, person *Person, confirm bool) error" ,
@@ -62,7 +62,7 @@ func TestMoqWithStaticCheck(t *testing.T) {
6262 }
6363 s := buf .String ()
6464 // assertions of things that should be mentioned
65- var strs = []string {
65+ strs : = []string {
6666 "package example" ,
6767 "var _ PersonStore = &PersonStoreMock{}" ,
6868 "type PersonStoreMock struct" ,
@@ -96,7 +96,7 @@ func TestMoqWithAlias(t *testing.T) {
9696 }
9797 s := buf .String ()
9898 // assertions of things that should be mentioned
99- var strs = []string {
99+ strs : = []string {
100100 "package example" ,
101101 "type AnotherPersonStoreMock struct" ,
102102 "CreateFunc func(ctx context.Context, person *Person, confirm bool) error" ,
@@ -129,7 +129,7 @@ func TestMoqExplicitPackage(t *testing.T) {
129129 }
130130 s := buf .String ()
131131 // assertions of things that should be mentioned
132- var strs = []string {
132+ strs : = []string {
133133 "package different" ,
134134 "type PersonStoreMock struct" ,
135135 "CreateFunc func(ctx context.Context, person *example.Person, confirm bool) error" ,
@@ -156,7 +156,7 @@ func TestMoqExplicitPackageWithStaticCheck(t *testing.T) {
156156 }
157157 s := buf .String ()
158158 // assertions of things that should be mentioned
159- var strs = []string {
159+ strs : = []string {
160160 "package different" ,
161161 "var _ example.PersonStore = &PersonStoreMock{}" ,
162162 "type PersonStoreMock struct" ,
@@ -184,7 +184,7 @@ func TestMoqSkipEnsure(t *testing.T) {
184184 }
185185 s := buf .String ()
186186 // assertions of things that should be mentioned
187- var strs = []string {
187+ strs : = []string {
188188 "package different" ,
189189 "type PersonStoreMock struct" ,
190190 "CreateFunc func(ctx context.Context, person *example.Person, confirm bool) error" ,
@@ -233,7 +233,7 @@ func TestVariadicArguments(t *testing.T) {
233233 }
234234 s := buf .String ()
235235 // assertions of things that should be mentioned
236- var strs = []string {
236+ strs : = []string {
237237 "package variadic" ,
238238 "type GreeterMock struct" ,
239239 "GreetFunc func(ctx context.Context, names ...string) string" ,
@@ -261,7 +261,7 @@ func TestNothingToReturn(t *testing.T) {
261261 t .Errorf ("should not have return for items that have no return arguments" )
262262 }
263263 // assertions of things that should be mentioned
264- var strs = []string {
264+ strs : = []string {
265265 "mock.ClearCacheFunc(id)" ,
266266 }
267267 for _ , str := range strs {
@@ -282,7 +282,7 @@ func TestImports(t *testing.T) {
282282 t .Errorf ("m.Mock: %s" , err )
283283 }
284284 s := buf .String ()
285- var strs = []string {
285+ strs : = []string {
286286 ` "sync"` ,
287287 ` "github.com/matryer/moq/pkg/moq/testpackages/imports/one"` ,
288288 }
@@ -395,6 +395,12 @@ func TestMockGolden(t *testing.T) {
395395 interfaces : []string {"Transient" },
396396 goldenFile : filepath .Join ("testpackages/transientimport" , "transient_moq.golden.go" ),
397397 },
398+ {
399+ name : "WithResets" ,
400+ cfg : Config {SrcDir : "testpackages/withresets" , WithResets : true },
401+ interfaces : []string {"ResetStore" },
402+ goldenFile : filepath .Join ("testpackages/withresets" , "withresets_moq.golden.go" ),
403+ },
398404 }
399405 for _ , tc := range cases {
400406 t .Run (tc .name , func (t * testing.T ) {
@@ -449,10 +455,10 @@ func matchGoldenFile(goldenFile string, actual []byte) error {
449455 // To update golden files, run the following:
450456 // go test -v -run '^<Test-Name>$' github.com/matryer/moq/pkg/moq -update
451457 if * update {
452- if err := os .MkdirAll (filepath .Dir (goldenFile ), 0750 ); err != nil {
458+ if err := os .MkdirAll (filepath .Dir (goldenFile ), 0o750 ); err != nil {
453459 return fmt .Errorf ("create dir: %s" , err )
454460 }
455- if err := ioutil .WriteFile (goldenFile , actual , 0600 ); err != nil {
461+ if err := ioutil .WriteFile (goldenFile , actual , 0o600 ); err != nil {
456462 return fmt .Errorf ("write: %s" , err )
457463 }
458464
@@ -495,7 +501,7 @@ func TestVendoredPackages(t *testing.T) {
495501 }
496502 s := buf .String ()
497503 // assertions of things that should be mentioned
498- var strs = []string {
504+ strs : = []string {
499505 `"github.com/sudo-suhas/moq-test-pkgs/somerepo"` ,
500506 }
501507 for _ , str := range strs {
@@ -520,7 +526,7 @@ func TestVendoredInterface(t *testing.T) {
520526 }
521527 s := buf .String ()
522528 // assertions of things that should be mentioned
523- var strs = []string {
529+ strs : = []string {
524530 `"github.com/sudo-suhas/moq-test-pkgs/somerepo"` ,
525531 }
526532 for _ , str := range strs {
@@ -546,7 +552,7 @@ func TestVendoredBuildConstraints(t *testing.T) {
546552 }
547553 s := buf .String ()
548554 // assertions of things that should be mentioned
549- var strs = []string {
555+ strs : = []string {
550556 `"github.com/sudo-suhas/moq-test-pkgs/buildconstraints"` ,
551557 }
552558 for _ , str := range strs {
0 commit comments