wireexample/基于golangci-lint修改代码;

This commit is contained in:
2023-04-14 23:28:06 +08:00
parent 046bd80bf9
commit 13de8b9b6c
3 changed files with 141 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ func approachA() {
rander := &MockRander{}
guess := InjectGuessWithoutMock(rander)
rander.Value = 1
fmt.Println("approachA:", guess.Guess(10))
fmt.Println("approachA:", guess.Guess(10)) //nolint:gomnd
}
// approach B:
@@ -25,5 +25,5 @@ func approachA() {
func approachB() {
guessWithMock := InjectMockGuess()
guessWithMock.Mock.Value = 1
fmt.Println("approachB:", guessWithMock.Guess.Guess(10))
fmt.Println("approachB:", guessWithMock.Guess.Guess(10)) //nolint:gomnd
}

View File

@@ -14,7 +14,7 @@ type Rander interface {
type DefaultRander struct{}
func (r *DefaultRander) Rand() int {
return rand.Int()
return rand.Int() //nolint:gosec
}
func NewRander() *DefaultRander {