diff options
author | Alan Donovan <adonovan@google.com> | 2018-10-15 18:10:24 -0400 |
---|---|---|
committer | Alan Donovan <adonovan@google.com> | 2018-10-16 20:28:15 +0000 |
commit | a0ecdcbec46f2cd944b1ad9e1ffb51b94f227b6b (patch) | |
tree | 3aba7cfc4c7bb84464b75cfc811c49ea5ee4b474 /go/analysis/passes/nilfunc | |
parent | 63d31665e311d0da81db6a27060589b038fad816 (diff) | |
download | golang-x-tools-a0ecdcbec46f2cd944b1ad9e1ffb51b94f227b6b.tar.gz |
go/analysis/passes: add doc and copyright comments
...and other trivial cleanups.
Multi-line doc comments have been moved to exported Doc constants for
the sake of godoc.
Change-Id: Ib1cbec5806c699d51283c34685c4cd96953f5384
Reviewed-on: https://go-review.googlesource.com/c/142360
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'go/analysis/passes/nilfunc')
-rw-r--r-- | go/analysis/passes/nilfunc/nilfunc.go | 12 | ||||
-rw-r--r-- | go/analysis/passes/nilfunc/nilfunc_test.go | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/go/analysis/passes/nilfunc/nilfunc.go b/go/analysis/passes/nilfunc/nilfunc.go index 7a2344ff6..9c2d4df20 100644 --- a/go/analysis/passes/nilfunc/nilfunc.go +++ b/go/analysis/passes/nilfunc/nilfunc.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// Package nilfunc defines an Analyzer that checks for useless +// comparisons against nil. package nilfunc import ( @@ -14,11 +16,13 @@ import ( "golang.org/x/tools/go/ast/inspector" ) -var Analyzer = &analysis.Analyzer{ - Name: "nilfunc", - Doc: `check for useless comparisons between functions and nil +const Doc = `check for useless comparisons between functions and nil + +A useless comparison is one like f == nil as opposed to f() == nil.` -A useless comparison is one like f == nil as opposed to f() == nil.`, +var Analyzer = &analysis.Analyzer{ + Name: "nilfunc", + Doc: Doc, Requires: []*analysis.Analyzer{inspect.Analyzer}, Run: run, } diff --git a/go/analysis/passes/nilfunc/nilfunc_test.go b/go/analysis/passes/nilfunc/nilfunc_test.go index 8218e7134..6eac063d5 100644 --- a/go/analysis/passes/nilfunc/nilfunc_test.go +++ b/go/analysis/passes/nilfunc/nilfunc_test.go @@ -1,3 +1,7 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package nilfunc_test import ( |