go/ssa: fix vet issues

The new go/analysis/cmd/vet tool found a few issues. Fix them by
explicitly ignoring results where needed and renaming examples in
accordance to package testing's guidelines to make them appear on the
godoc pages.

This change doesn't touch go/ssa/interp/external.go because the
possible misuse of package unsafe there looks intentional.

Change-Id: Id63109e3797818a5e869fe8ed1bc1476959541f2
Reviewed-on: https://go-review.googlesource.com/c/147297
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/go/ssa/example_test.go b/go/ssa/example_test.go
index c33b6d6..de5ed5e 100644
--- a/go/ssa/example_test.go
+++ b/go/ssa/example_test.go
@@ -49,7 +49,7 @@
 // with similar functionality. It is located at
 // golang.org/x/tools/cmd/ssadump.
 //
-func ExampleBuildPackage() {
+func Example_buildPackage() {
 	// Parse the source files.
 	fset := token.NewFileSet()
 	f, err := parser.ParseFile(fset, "hello.go", hello, parser.ParseComments)
@@ -117,7 +117,7 @@
 // This example builds SSA code for a set of packages using the
 // x/tools/go/packages API. This is what you would typically use for a
 // analysis capable of operating on a single package.
-func ExampleLoadPackages() {
+func Example_loadPackages() {
 	// Load, parse, and type-check the initial packages.
 	cfg := &packages.Config{Mode: packages.LoadSyntax}
 	initial, err := packages.Load(cfg, "fmt", "net/http")
@@ -147,7 +147,7 @@
 // This example builds SSA code for a set of packages plus all their dependencies,
 // using the x/tools/go/packages API.
 // This is what you'd typically use for a whole-program analysis.
-func ExampleLoadWholeProgram() {
+func Example_loadWholeProgram() {
 	// Load, parse, and type-check the whole program.
 	cfg := packages.Config{Mode: packages.LoadAllSyntax}
 	initial, err := packages.Load(&cfg, "fmt", "net/http")
diff --git a/go/ssa/sanity.go b/go/ssa/sanity.go
index 6eb6432..0a7abc5 100644
--- a/go/ssa/sanity.go
+++ b/go/ssa/sanity.go
@@ -408,8 +408,8 @@
 		s.errorf("nil Prog")
 	}
 
-	fn.String()            // must not crash
-	fn.RelString(fn.pkg()) // must not crash
+	_ = fn.String()            // must not crash
+	_ = fn.RelString(fn.pkg()) // must not crash
 
 	// All functions have a package, except delegates (which are
 	// shared across packages, or duplicated as weak symbols in a
@@ -499,7 +499,7 @@
 	if pkg.Pkg == nil {
 		panic(fmt.Sprintf("Package %s has no Object", pkg))
 	}
-	pkg.String() // must not crash
+	_ = pkg.String() // must not crash
 
 	for name, mem := range pkg.Members {
 		if name != mem.Name() {