You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This reports a bug that renders some testable examples without a main block, making them not runnable. It seems to happen anytime the import path ends with a vN major version suffix that doesn't match the package name.
See the corresponding testable example code here and the import that ends in /v3here. Using an import alias that matches the package name resolves the issue. For example:
import cli "github.com/urfave/cli/v3"
What is your user agent?
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/113.0
I believe @seankhliao is correct. The "v1" testable examples are in the cli package rather than the cli_test package, which also prevents the examples from being runnable. Check out the "NoAction" example here and the corresponding test code here.
For "v3", the testable examples were moved into the cli_test package, but are also not runnable (seemingly because they have a major version suffix).
I think this may actually be a bug (or missing feature) in the go/doc example parser. I created a playground example that uses doc.Examples to parse a "playable" example from a test that imports a package with a major version suffix: https://go.dev/play/p/V8RY15XlJZy
Notice that doc.Examples is not able to create a "playable" example when the package ends in v3 (instead of cli) unless you specify an import alias. Since the major version suffix is a requirement for v2+ Go modules, it seems like the go/doc package should know how to handle them.