wireexample/基于golangci-lint修改代码;
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user