Apologies for not following the template, it did not seem relevant since my issue is with the documentation of crypto/x509 as it currently shows on https://pkg.go.dev/crypto/x509#ParsePKCS8PrivateKey. I also did not open this issue as a pkg.go.dev bug since it's an issue with the package's documentation, not the documentation website itself. If either decision was incorrect please let me know and I'll correct them.
The documentation for x509.ParsePKCS8PrivateKey mentions the possible return types of the function as:
It returns a *rsa.PrivateKey, a *ecdsa.PrivateKey, a ed25519.PrivateKey (not a pointer), or a *ecdh.PublicKey (for X25519).
However, in the case of X25519, the actual implementation returns a *ecdh.PrivateKey (ref), which makes more sense, and also fits with what types x509.MarshalPKCS8PrivateKey is documented to accept for the key parameter.
Therefore it looks to me like the documentation is incorrect, and should instead be:
It returns a *rsa.PrivateKey, a *ecdsa.PrivateKey, a ed25519.PrivateKey (not a pointer), or a *ecdh.PrivateKey (for X25519).
Apologies for not following the template, it did not seem relevant since my issue is with the documentation of
crypto/x509as it currently shows on https://pkg.go.dev/crypto/x509#ParsePKCS8PrivateKey. I also did not open this issue as a pkg.go.dev bug since it's an issue with the package's documentation, not the documentation website itself. If either decision was incorrect please let me know and I'll correct them.The documentation for
x509.ParsePKCS8PrivateKeymentions the possible return types of the function as:However, in the case of X25519, the actual implementation returns a
*ecdh.PrivateKey(ref), which makes more sense, and also fits with what typesx509.MarshalPKCS8PrivateKeyis documented to accept for thekeyparameter.Therefore it looks to me like the documentation is incorrect, and should instead be: