From e4067d2fb32e90a7174e1e46b6ed9afcb370ad38 Mon Sep 17 00:00:00 2001 From: sanposhiho Date: Thu, 4 Mar 2021 22:36:32 +0900 Subject: [PATCH] Fix: Match the wording of the readme and report from wastedassign --- testdata/src/a/a.go | 16 ++++++++-------- wastedassign.go | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/testdata/src/a/a.go b/testdata/src/a/a.go index 5718bcf..7b2ea26 100644 --- a/testdata/src/a/a.go +++ b/testdata/src/a/a.go @@ -28,28 +28,28 @@ func noUseParams(params string) int { func f(param int) int { println(param) - useOutOfIf := 1212121 // want "wasted assignment" + useOutOfIf := 1212121 // want "reassigned, but reassigned without using the value" ret := 0 if false { useOutOfIf = 200 // want "reassigned, but never used afterwards" return 0 } else if param == 100 { - useOutOfIf = 100 // want "wasted assignment" + useOutOfIf = 100 // want "reassigned, but reassigned without using the value" useOutOfIf = 201 useOutOfIf = pa(useOutOfIf) - useOutOfIf += 200 // want "wasted assignment" + useOutOfIf += 200 // want "reassigned, but reassigned without using the value" } else { useOutOfIf = 100 useOutOfIf += 100 useOutOfIf = pa(useOutOfIf) - useOutOfIf += 200 // want "wasted assignment" + useOutOfIf += 200 // want "reassigned, but reassigned without using the value" } if false { useOutOfIf = 200 // want "reassigned, but never used afterwards" return 0 } else if param == 200 { - useOutOfIf = 100 // want "wasted assignment" + useOutOfIf = 100 // want "reassigned, but reassigned without using the value" useOutOfIf = 201 useOutOfIf = pa(useOutOfIf) useOutOfIf += 200 @@ -92,10 +92,10 @@ func r(param int) int { } else if param == 100 { ret = useOutOfIf } else if param == 200 { - useOutOfIf = 100 // want "wasted assignment" + useOutOfIf = 100 // want "reassigned, but reassigned without using the value" useOutOfIf = 100 useOutOfIf = pa(useOutOfIf) - useOutOfIf += 200 // want "wasted assignment" + useOutOfIf += 200 // want "reassigned, but reassigned without using the value" } useOutOfIf = 12 println(useOutOfIf) @@ -109,7 +109,7 @@ func mugen() { var i int var hoge int for { - hoge = 5 // want "wasted assignment" + hoge = 5 // want "reassigned, but reassigned without using the value" // break } diff --git a/wastedassign.go b/wastedassign.go index 21b8de1..00f085a 100644 --- a/wastedassign.go +++ b/wastedassign.go @@ -155,7 +155,7 @@ func (wr wastedReason) String() string { case noUseUntilReturn: return "reassigned, but never used afterwards" case reassignedSoon: - return "wasted assignment" + return "reassigned, but reassigned without using the value" case notWasted: return "" default: