Skip to content

Replace directive in examples/go.mod breaks 'go run charm.land/.../examples/...@latest' #1681

@mpictor

Description

@mpictor

Describe the bug

It doesn't seem to be possible to go run the examples with their fully qualified paths.

Setup

Gentoo/bash/konsole, though this should have no effect since no charm.land code is running.

To Reproduce

$ go version
go version go1.26.1 linux/amd64
$ go run charm.land/bubbletea/examples/doom-fire@latest
go: charm.land/bubbletea/examples/doom-fire@latest (in charm.land/bubbletea/examples@v0.0.0-20260420134506-074596e14e2f):
        The go.mod file for the module providing named packages contains one or
        more replace directives. It must not contain directives that would cause
        it to be interpreted differently than if it were the main module.

I tried some slightly different commands, to no avail:

$ go run charm.land/bubbletea/v2/examples/doom-fire@latest
go: downloading charm.land/bubbletea/v2 v2.0.6
go: charm.land/bubbletea/v2/examples/doom-fire@latest: module charm.land/bubbletea/v2@latest found (v2.0.6), but does not contain package charm.land/bubbletea/v2/examples/doom-fire
$ go run charm.land/bubbletea/examples/v2/doom-fire@latest
go: charm.land/bubbletea/examples/v2/doom-fire@latest: module charm.land/bubbletea/examples@latest found (v0.0.0-20260420134506-074596e14e2f), but does not contain package charm.land/bubbletea/examples/v2/doom-fire

I can run the downloaded version from $GOPATH/pkg/mod, if I'm in a module importing bubbletea, but seemingly not othewise. A bit strange, though (IMO) not important enough to dig into and unlikely to be related to the main issue.

$ go run ~/go/pkg/mod/charm.land/bubbletea/examples\@v0.0.0-20260420134506-074596e14e2f/doom-fire/main.go
<success>

Source Code
I used the doom-fire example, though any should suffice.

Expected behavior
Ideally, the examples can be run with go run charm.land/<blah> rather than needing to git clone charm.land/bubbletea; cd bubbletea/examples; go run ./<blah>

However, from the error message it seems necessary to remove the replace directive to make it work.

Slightly related (also mentions replace directive): #16

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions