Skip to content

x/pkgsite: examples in external test packages are not runnable #62059

@matthewdale

Description

@matthewdale

What is the URL of the page with the issue?

https://pkg.go.dev/github.com/urfave/cli/v3@v3.0.0-alpha4#example-Command.Run-NoAction

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 /v3 here. 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

Screenshot

Screenshot 2023-08-05 at 4 37 42 PM

What did you do?

Go to https://pkg.go.dev/github.com/urfave/cli/v3@v3.0.0-alpha4#example-Command.Run-NoAction and try to run the "NoAction" example (or any example for the github.com/urfave/cli/v3 package).

What did you expect to see?

A runnable code example with a main block and a "Run" button.

What did you see instead?

A code example with no main block and no "Run" button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.pkgsite

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions