x/ref: Remove verror.Is and verror.Equal

It's simpler to just use verror.ErrorID instead

MultiPart: 2/2
Change-Id: I12886abe7e7d6345186022b9127d45c6fff54ec6
diff --git a/profiles/internal/rpc/client.go b/profiles/internal/rpc/client.go
index 194d12a..3aab4f9 100644
--- a/profiles/internal/rpc/client.go
+++ b/profiles/internal/rpc/client.go
@@ -389,7 +389,7 @@
 		// We always return NoServers as the error so that the caller knows
 		// that's ok to retry the operation since the name may be registered
 		// in the near future.
-		if verror.Is(err, naming.ErrNoSuchName.ID) {
+		if verror.ErrorID(err) == naming.ErrNoSuchName.ID {
 			return nil, verror.RetryRefetch, verror.New(verror.ErrNoServers, ctx, name)
 		}
 		return nil, verror.NoRetry, verror.New(verror.ErrNoServers, ctx, name, err)
@@ -467,7 +467,7 @@
 		case <-timeoutChan:
 			vlog.VI(2).Infof("rpc: timeout on connection to server %v ", name)
 			_, _, err := c.failedTryCall(ctx, name, method, responses, ch)
-			if !verror.Is(err, verror.ErrTimeout.ID) {
+			if verror.ErrorID(err) != verror.ErrTimeout.ID {
 				return nil, verror.NoRetry, verror.New(verror.ErrTimeout, ctx, err)
 			}
 			return nil, verror.NoRetry, err
@@ -578,7 +578,7 @@
 	for _, r := range responses {
 		if r != nil && r.err != nil {
 			switch {
-			case verror.Is(r.err, verror.ErrNotTrusted.ID) || verror.Is(r.err, errAuthError.ID):
+			case verror.ErrorID(r.err) == verror.ErrNotTrusted.ID || verror.ErrorID(r.err) == errAuthError.ID:
 				untrusted = append(untrusted, "("+r.err.Error()+") ")
 			default:
 				noconn = append(noconn, "("+r.err.Error()+") ")
@@ -715,7 +715,7 @@
 		return verror.New(verror.ErrInternal, fc.ctx, err)
 	}
 	switch {
-	case verror.Is(err, verror.ErrBadProtocol.ID):
+	case verror.ErrorID(err) == verror.ErrBadProtocol.ID:
 		switch fc.ctx.Err() {
 		case context.DeadlineExceeded:
 			// TODO(cnicolaou,m3b): reintroduce 'append' when the new verror API is done.
@@ -726,7 +726,7 @@
 			//return verror.Append(verror.New(verror.ErrCanceled, fc.ctx), verr)
 			return verror.New(verror.ErrCanceled, fc.ctx, err.Error())
 		}
-	case verror.Is(err, verror.ErrTimeout.ID):
+	case verror.ErrorID(err) == verror.ErrTimeout.ID:
 		// Canceled trumps timeout.
 		if fc.ctx.Err() == context.Canceled {
 			// TODO(cnicolaou,m3b): reintroduce 'append' when the new verror API is done.
@@ -917,7 +917,7 @@
 	if fc.response.Error != nil {
 		// TODO(cnicolaou): remove verror.ErrNoAccess with verror version
 		// when rpc.Server is converted.
-		if verror.Is(fc.response.Error, verror.ErrNoAccess.ID) && fc.dc != nil {
+		if verror.ErrorID(fc.response.Error) == verror.ErrNoAccess.ID && fc.dc != nil {
 			// In case the error was caused by a bad discharge, we do not want to get stuck
 			// with retrying again and again with this discharge. As there is no direct way
 			// to detect it, we conservatively flush all discharges we used from the cache.
diff --git a/profiles/internal/rpc/full_test.go b/profiles/internal/rpc/full_test.go
index 05314cb..5d555d3 100644
--- a/profiles/internal/rpc/full_test.go
+++ b/profiles/internal/rpc/full_test.go
@@ -307,7 +307,7 @@
 
 	// Check that we can no longer serve after Stop.
 	err := server.AddName("name doesn't matter")
-	if err == nil || !verror.Is(err, verror.ErrBadState.ID) {
+	if err == nil || verror.ErrorID(err) != verror.ErrBadState.ID {
 		t.Errorf("either no error, or a wrong error was returned: %v", err)
 	}
 	vlog.VI(1).Info("server.Stop DONE")
@@ -375,7 +375,7 @@
 	if err == nil && id.ID == "" {
 		return true
 	}
-	return verror.Is(err, id.ID)
+	return verror.ErrorID(err) == id.ID
 }
 
 func runServer(t *testing.T, ctx *context.T, ns ns.Namespace, principal security.Principal, name string, obj interface{}, opts ...rpc.ServerOpt) stream.Manager {
@@ -642,7 +642,7 @@
 	}
 	defer client.Close()
 	ctx, _ = v23.SetPrincipal(ctx, pclient)
-	if _, err := client.StartCall(ctx, "mountpoint/server", "Closure", nil); !verror.Is(err, verror.ErrNotTrusted.ID) {
+	if _, err := client.StartCall(ctx, "mountpoint/server", "Closure", nil); verror.ErrorID(err) != verror.ErrNotTrusted.ID {
 		t.Errorf("Got error %v (errorid=%v), want errorid=%v", err, verror.ErrorID(err), verror.ErrNotTrusted.ID)
 	}
 	// But the RPC should succeed if the client explicitly
@@ -769,7 +769,7 @@
 		err = call.Finish(results...)
 		if got, want := err, test.finishErr; (got == nil) != (want == nil) {
 			t.Errorf(`%s call.Finish got error "%v", want "%v'`, name(test), got, want)
-		} else if want != nil && !verror.Is(got, verror.ErrorID(want)) {
+		} else if want != nil && verror.ErrorID(got) != verror.ErrorID(want) {
 			t.Errorf(`%s call.Finish got error "%v", want "%v"`, name(test), got, want)
 		}
 		checkResultPtrs(t, name(test), results, test.results)
@@ -1137,7 +1137,7 @@
 			t.Errorf(`%s call.Finish got error: "%v", wanted the RPC to succeed`, name, err)
 		} else if err == nil && !test.authorized {
 			t.Errorf("%s call.Finish succeeded, expected authorization failure", name)
-		} else if !test.authorized && !verror.Is(err, verror.ErrNoAccess.ID) {
+		} else if !test.authorized && verror.ErrorID(err) != verror.ErrNoAccess.ID {
 			t.Errorf("%s. call.Finish returned error %v(%v), wanted %v", name, verror.ErrorID(verror.Convert(verror.ErrNoAccess, nil, err)), err, verror.ErrNoAccess)
 		}
 	}
@@ -1506,7 +1506,7 @@
 
 	ctx, _ = v23.SetPrincipal(ctx, pclient)
 	_, err := b.client.StartCall(ctx, "incompatible/suffix", "Echo", []interface{}{"foo"}, options.NoRetry{})
-	if !verror.Is(err, verror.ErrNoServers.ID) {
+	if verror.ErrorID(err) != verror.ErrNoServers.ID {
 		t.Errorf("Expected error %s, found: %v", verror.ErrNoServers, err)
 	}
 
@@ -1654,7 +1654,7 @@
 	if call != nil {
 		t.Errorf("Expected nil interface got: %#v", call)
 	}
-	if !verror.Is(err, verror.ErrBadArg.ID) {
+	if verror.ErrorID(err) != verror.ErrBadArg.ID {
 		t.Errorf("Expected an BadArg error, got: %s", err.Error())
 	}
 }
@@ -1956,7 +1956,7 @@
 		t.Errorf("Expected call to succeed but got %v", err)
 	}
 	// ...but fail if they differ.
-	if _, err = client.StartCall(ctx, mountName, "Closure", nil, options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{pother.PublicKey()}); !verror.Is(err, verror.ErrNotTrusted.ID) {
+	if _, err = client.StartCall(ctx, mountName, "Closure", nil, options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{pother.PublicKey()}); verror.ErrorID(err) != verror.ErrNotTrusted.ID {
 		t.Errorf("got %v, want %v", verror.ErrorID(err), verror.ErrNotTrusted.ID)
 	}
 }
diff --git a/profiles/internal/rpc/server_test.go b/profiles/internal/rpc/server_test.go
index 403ce73..ce935c9 100644
--- a/profiles/internal/rpc/server_test.go
+++ b/profiles/internal/rpc/server_test.go
@@ -102,11 +102,11 @@
 	}
 	defer server.Stop()
 	_, err = server.Listen(rpc.ListenSpec{})
-	if !verror.Is(err, verror.ErrBadArg.ID) {
+	if verror.ErrorID(err) != verror.ErrBadArg.ID {
 		t.Fatalf("expected a BadArg error: got %v", err)
 	}
 	_, err = server.Listen(rpc.ListenSpec{Addrs: rpc.ListenAddrs{{"tcp", "*:0"}}})
-	if !verror.Is(err, verror.ErrBadArg.ID) {
+	if verror.ErrorID(err) != verror.ErrBadArg.ID {
 		t.Fatalf("expected a BadArg error: got %v", err)
 	}
 	_, err = server.Listen(rpc.ListenSpec{
@@ -114,7 +114,7 @@
 			{"tcp", "*:0"},
 			{"tcp", "127.0.0.1:0"},
 		}})
-	if verror.Is(err, verror.ErrBadArg.ID) {
+	if verror.ErrorID(err) == verror.ErrBadArg.ID {
 		t.Fatalf("expected a BadArg error: got %v", err)
 	}
 	status := server.Status()
@@ -122,7 +122,7 @@
 		t.Fatalf("got %s, want %s", got, want)
 	}
 	_, err = server.Listen(rpc.ListenSpec{Addrs: rpc.ListenAddrs{{"tcp", "*:0"}}})
-	if !verror.Is(err, verror.ErrBadArg.ID) {
+	if verror.ErrorID(err) != verror.ErrBadArg.ID {
 		t.Fatalf("expected a BadArg error: got %v", err)
 	}
 	status = server.Status()
@@ -237,7 +237,7 @@
 	defer shutdown()
 
 	expectBadState := func(err error) {
-		if !verror.Is(err, verror.ErrBadState.ID) {
+		if verror.ErrorID(err) != verror.ErrBadState.ID {
 			t.Fatalf("%s: unexpected error: %v", loc(1), err)
 		}
 	}
diff --git a/profiles/internal/rpc/test/client_test.go b/profiles/internal/rpc/test/client_test.go
index 4c831f4..fafec63 100644
--- a/profiles/internal/rpc/test/client_test.go
+++ b/profiles/internal/rpc/test/client_test.go
@@ -254,7 +254,7 @@
 	name := naming.JoinAddressName(naming.FormatEndpoint("tcp", "203.0.113.10:443"), "")
 	client := v23.GetClient(ctx)
 	_, err := client.StartCall(ctx, name, "echo", []interface{}{"args don't matter"})
-	if !verror.Is(err, verror.ErrTimeout.ID) {
+	if verror.ErrorID(err) != verror.ErrTimeout.ID {
 		t.Fatalf("wrong error: %s", err)
 	}
 }
@@ -296,7 +296,7 @@
 func testForVerror(t *testing.T, err error, verr verror.IDAction) {
 	_, file, line, _ := runtime.Caller(1)
 	loc := fmt.Sprintf("%s:%d", filepath.Base(file), line)
-	if !verror.Is(err, verr.ID) {
+	if verror.ErrorID(err) != verr.ID {
 		if _, ok := err.(verror.E); !ok {
 			t.Fatalf("%s: err %v not a verror", loc, err)
 		}
@@ -469,7 +469,7 @@
 	ctx, _ = context.WithTimeout(ctx, 300*time.Millisecond)
 	call, err := v23.GetClient(ctx).StartCall(ctx, name, "Source", []interface{}{want})
 	if err != nil {
-		if !verror.Is(err, verror.ErrTimeout.ID) {
+		if verror.ErrorID(err) != verror.ErrTimeout.ID {
 			t.Fatalf("verror should be a timeout not %s: stack %s",
 				err, verror.Stack(err))
 		}
diff --git a/profiles/internal/rpc/test/proxy_test.go b/profiles/internal/rpc/test/proxy_test.go
index 3a8c154..fb89398 100644
--- a/profiles/internal/rpc/test/proxy_test.go
+++ b/profiles/internal/rpc/test/proxy_test.go
@@ -350,7 +350,7 @@
 	verifyMountMissing(t, ctx, ns, name)
 
 	status = server.Status()
-	if len(status.Proxies) != 1 || status.Proxies[0].Proxy != spec.Proxy || !verror.Is(status.Proxies[0].Error, verror.ErrNoServers.ID) {
+	if len(status.Proxies) != 1 || status.Proxies[0].Proxy != spec.Proxy || verror.ErrorID(status.Proxies[0].Error) != verror.ErrNoServers.ID {
 		t.Fatalf("proxy status is incorrect: %v", status.Proxies)
 	}
 
diff --git a/profiles/internal/rpc/testutil_test.go b/profiles/internal/rpc/testutil_test.go
index bb43fdd..b48f6c6 100644
--- a/profiles/internal/rpc/testutil_test.go
+++ b/profiles/internal/rpc/testutil_test.go
@@ -48,7 +48,7 @@
 			if !ok {
 				t.Errorf("%s result %d got type %T, want %T", name, ix, g, w)
 			}
-			if !verror.Is(g, w.ID) {
+			if verror.ErrorID(g) != w.ID {
 				t.Errorf("%s result %d got %v, want %v", name, ix, g, w)
 			}
 		default: