]> Cypherpunks repositories - gostls13.git/commitdiff
go/build, go/doc: fix tautological conditions
authorAinar Garipov <gugl.zadolbal@gmail.com>
Fri, 9 Nov 2018 20:28:54 +0000 (23:28 +0300)
committerRobert Griesemer <gri@golang.org>
Sun, 11 Nov 2018 01:02:11 +0000 (01:02 +0000)
These issues were found by the new vet's nilness check. The variables
were already checked against nil, so remove extra checks.

Change-Id: Ie252ccfcc755f3d06f691f354bf13d5a623fe17b
Reviewed-on: https://go-review.googlesource.com/c/148937
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/go/build/read_test.go
src/go/doc/reader.go

index 9cef657e13fc145c8ffc22c07db0cf0889a2251a..2a36a012d5dfa6ff47b522b76257a5e150ec6462 100644 (file)
@@ -118,7 +118,7 @@ func testRead(t *testing.T, tests []readTest, read func(io.Reader) ([]byte, erro
                        }
                        continue
                }
-               if err == nil && tt.err != "" {
+               if tt.err != "" {
                        t.Errorf("#%d: success, expected %q", i, tt.err)
                        continue
                }
index 26365e46b5d279920a8165230b86c0008a18eadb..4950e7c6c38659aadc1738d10dd7f0c44ef0c740 100644 (file)
@@ -81,7 +81,7 @@ func (mset methodSet) add(m *Func) {
                mset[m.Name] = m
                return
        }
-       if old != nil && m.Level == old.Level {
+       if m.Level == old.Level {
                // conflict - mark it using a method with nil Decl
                mset[m.Name] = &Func{
                        Name:  m.Name,