From 6f99c60d15a6e5b9885e33a6354f364d26ab0615 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Mon, 21 Oct 2024 18:26:50 +0300 Subject: [PATCH] Remove redundant variable declarations --- cmd/mockery.go | 1 - pkg/generator_test.go | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/cmd/mockery.go b/cmd/mockery.go index 360dea68..d524062f 100644 --- a/cmd/mockery.go +++ b/cmd/mockery.go @@ -186,7 +186,6 @@ func GetRootAppFromViper(v *viper.Viper) (*RootApp, error) { func (r *RootApp) Run() error { var recursive bool var filter *regexp.Regexp - var err error var limitOne bool if r.Quiet { diff --git a/pkg/generator_test.go b/pkg/generator_test.go index 82771589..22f19b49 100644 --- a/pkg/generator_test.go +++ b/pkg/generator_test.go @@ -71,7 +71,6 @@ func (s *GeneratorSuite) checkGenerationWithConfig( // it would require changing Write's signature to accept custom options, specifically to // allow the fragments in preexisting cases. It's assumed that this approximation, // just formatting the source, is sufficient for the needs of the current test styles. - var actual []byte actual, fmtErr := format.Source(generator.buf.Bytes()) s.Require().NoError(fmtErr) @@ -108,7 +107,6 @@ func (s *GeneratorSuite) checkGenerationRegexWithConfig( // it would require changing Write's signature to accept custom options, specifically to // allow the fragments in preexisting cases. It's assumed that this approximation, // just formatting the source, is sufficient for the needs of the current test styles. - var actual []byte actual, fmtErr := format.Source(generator.buf.Bytes()) s.Require().NoError(fmtErr) @@ -183,7 +181,6 @@ func (s *GeneratorSuite) TestGeneratorExpecterWithRolledVariadic() { ) s.Require().NoError(generator.Generate(s.ctx)) - var actual []byte actual, fmtErr := format.Source(generator.buf.Bytes()) s.Require().NoError(fmtErr) @@ -418,7 +415,6 @@ func (s *GeneratorSuite) TestGeneratorVariadicArgsAsOneArg() { ) s.Require().NoError(generator.Generate(s.ctx)) - var actual []byte actual, fmtErr := format.Source(generator.buf.Bytes()) s.Require().NoError(fmtErr) @@ -619,8 +615,7 @@ func (s *GeneratorSuite) TestGeneratorForStructValueReturn() { func (s *GeneratorSuite) TestGeneratorForStructWithTag() { // StructTag has back-quote, So can't use raw string literals in this test case. - var expected string - expected += "*struct {" + expected := "*struct {" expected += "FieldC int `json:\"field_c\"`" expected += "FieldD int `json:\"field_d\" xml:\"field_d\"`" expected += "}"