This code checks if the symtable path of an executable contains a $GOROOT path and filters out those paths. There might be cases when $GOROOT is a substring of a $GOPATH, such as:
GOROOT=/home/user/go
GOPATH=/home/user/gopath
gowhich tool needs to allow such paths.