code: func sanityCheckPackage(pkg *Package) {
  	if pkg.Pkg == nil {
  		panic(fmt.Sprintf("Package %s has no Object", pkg))
  	}
  	pkg.String() // must not crash
  
  	for name, mem := range pkg.Members {
  		if name != mem.Name() {
  			panic(fmt.Sprintf("%s: %T.Name() = %s, want %s",
  				pkg.Pkg.Path(), mem, mem.Name(), name))
  		}
  		obj := mem.Object()
  		if obj == nil {
  			// This check is sound because fields
  			// {Global,Function}.object have type
  			// types.Object.  (If they were declared as
  			// *types.{Var,Func}, we'd have a non-empty
  			// interface containing a nil pointer.)
  
  			continue // not all members have typechecker objects
  		}
  		if obj.Name() != name {
  			if obj.Name() == "init" && strings.HasPrefix(mem.Name(), "init#") {
  				// Ok.  The name of a declared init function varies between
  				// its types.Func ("init") and its ssa.Function ("init#%d").
  			} else {
  				panic(fmt.Sprintf("%s: %T.Object().Name() = %s, want %s",
  					pkg.Pkg.Path(), mem, obj.Name(), name))
  			}
  		}
  		if obj.Pos() != mem.Pos() {
  			panic(fmt.Sprintf("%s Pos=%d obj.Pos=%d", mem, mem.Pos(), obj.Pos()))
  		}
  	}
  }
docs: // sanityCheckPackage checks invariants of packages upon creation.
  // It does not require that the package is built.
  // Unlike sanityCheck (for functions), it just panics at the first error.