Go version

go version go1.24.4

Output of go env in your module/workspace:

(omitted: the issue is misleading content of the public document)

What did you do?

  • Read the public documentation for crypto/cipher.NewGCMWithRandomNonce
  • Observed that the documentation for the cipher.Block parameter links to an internal package
  • Investigated the standard library source code at https://github.com/golang/go/blob/master/src/crypto/cipher/gcm.go to understand why
  • Confirmed that the source code itself imports and uses an internal aes package, not the public crypto/aes

What did you see happen?

The doc engine possibly pointed to the correct link (the function of the internal package) but the function of the internal package cannot be used by developers(the users of standard go package).

The documentation is misleading, as it doesn't guide the user on how to correctly use the public API.

What did you expect to see?

For public APIs, I expect the documentation to link to the corresponding public types and functions that a developer should use.

In this case, the link should direct to crypto/aes.NewCipher(e.g., by explicitly writing the url to the correct function, not relying on the doc engine to generate the link which may point to the wrong one), as that is the function a user must call to satisfy the cipher.Block requirement. The internal implementation details of the crypto/cipher package should not be exposed in the user-facing documentation for that package.