Revert "add nilassign linter" (#2154)

This reverts commit bbf0450265.
This commit is contained in:
Ludovic Fernandez 2021-08-03 17:30:42 +02:00 committed by GitHub
parent 85f8a604a5
commit 15963edb57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 76 deletions

View file

@ -1,28 +0,0 @@
//args: -Enilassign
package testdata
var num = 1
func pvar() {
var ii *int
*ii = 1 // ERROR "this assignment occurs invalid memory address or nil pointer dereference"
var i *int
i = &num // OK
_ = i // OK
}
func pstruct() {
n := new(Node)
*n.PVal = 1 // ERROR "this assignment occurs invalid memory address or nil pointer dereference"
*n.ChildNode.PVal = 1 // ERROR "this assignment occurs invalid memory address or nil pointer dereference"
n.ChildNode = &Node{PVal: &num} // OK
n.PVal = &num // OK
}
type Node struct {
PVal *int
ChildNode *Node
}