My formulation was not clear. The test fails, and it reports a key mismatch.
Le mardi 27 octobre 2020 à 16:21:05 UTC+1, christoph...@gmail.com a écrit : > I have the following test that fails reporting a key mismatch. > > func TestKeyEqual(t *testing.T) { > key, err := rsa.GenerateKey(rand.Reader, 2048) > if err != nil { > t.Fatal("failed generating private key: ", err) > } > if !key.PublicKey.Equal(key.PublicKey) { > t.Fatal("key mismatch") > } > } > > Why is that ? Shouldn’t it return true ? > > Initially I compared key after save and reload read, and since it failed, > I just tested the same key for equality to verify that Equal was working as > expected. Apparently it does not or I’m doing something wrong. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/6daac7c2-a2cb-4a35-a477-1234ae516546n%40googlegroups.com.