-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ambiguous import, cannot build example #59
Comments
The examples do not have their own go.mod file. You can run them from the root of the project like: Or if you use VS code there are run commands setup for each. |
This section of the error message you see is the key. You would need to run each of those "go get" commands. main.go:7:2: no required module provides package github.com/ebitenui/ebitenui; to add it: |
go get github.com/ebitenui/ebitenui
go get github.com/ebitenui/ebitenui/image
go get github.com/ebitenui/ebitenui/widget
go get github.com/golang/freetype/truetype
go get github.com/hajimehoshi/ebiten/v2
go get golang.org/x/image/font
go get golang.org/x/image/font/gofont/goregular
# go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.4.18/internal/gamepad/api_linux.go:23:2: missing go.sum entry for module providing package golang.org/x/sys/unix (imported by github.com/hajimehoshi/ebiten/v2/internal/gamepad); to add:
go get github.com/hajimehoshi/ebiten/v2/internal/gamepad@v2.4.18 makes > go mod tidy
domain.com/project/go/pkg/mod/github.com/davecgh/go-spew@v1.1.1/spew: import path "domain.com/project/go/pkg/mod/github.com/davecgh/go-spew@v1.1.1/spew" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/capjoin: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/capjoin" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/drawer: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/drawer" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/freetype: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/freetype" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/gamma: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/gamma" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/genbasicfont: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/genbasicfont" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/raster: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/raster" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/round: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/round" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/truetype: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/example/truetype" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/raster: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/raster" should not have @version
domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/truetype: import path "domain.com/project/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/truetype" should not have @version
domain.com/project/go/pkg/mod/github.com/pmezard/go-difflib@v1.0.0/difflib: import path "domain.com/project/go/pkg/mod/github.com/pmezard/go-difflib@v1.0.0/difflib" should not have @version Is this normal? |
That is not normal. I don't know why you would be seeing an issue like that |
Turns out it was user error. Project cannot be in home dir. Moving anywhere else fixes it. |
Thank you for the update! |
Okay, after digging some more, and sometimes reproducing issue outside of home dir, here is more details. Min example
package main
import (
_ "github.com/ebitenui/ebitenui"
_ "github.com/hajimehoshi/ebiten/v2"
)
func main() {} > mkdir project
> cd project
> # add main.go contents
> go clean -modcache
> rm -f go.md go.sum
> go mod init domain.com/project
> go mod tidy
go: finding module for package github.com/hajimehoshi/ebiten/v2
go: finding module for package github.com/ebitenui/ebitenui
go: downloading github.com/ebitenui/ebitenui v0.4.2
go: downloading github.com/hajimehoshi/ebiten v1.12.12
go: downloading github.com/hajimehoshi/ebiten/v2 v2.4.18
go: found github.com/ebitenui/ebitenui in github.com/ebitenui/ebitenui v0.4.2
go: found github.com/hajimehoshi/ebiten/v2 in github.com/hajimehoshi/ebiten/v2 v2.4.18
go: downloading github.com/hajimehoshi/file2byteslice v1.0.0
go: downloading github.com/jezek/xgb v1.1.0
go: downloading golang.org/x/mobile v0.0.0-20221110043201-43a038452099
go: downloading golang.org/x/sys v0.4.0
go: downloading github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b
go: downloading github.com/matryer/is v1.4.0
go: downloading github.com/stretchr/testify v1.8.1
go: downloading golang.org/x/image v0.3.0
go: downloading github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
go: downloading golang.org/x/exp/shiny v0.0.0-20230203172020-98cc5a0785f9
go: downloading github.com/ebitengine/purego v0.1.1
go: downloading github.com/hajimehoshi/bitmapfont/v2 v2.2.2
go: downloading golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/stretchr/objx v0.5.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading golang.org/x/text v0.6.0
domain.com/project imports
github.com/hajimehoshi/ebiten/v2 imports
github.com/hajimehoshi/ebiten/v2/internal/ui imports
golang.org/x/mobile/app imports
golang.org/x/exp/shiny/driver/gldriver: ambiguous import: found package golang.org/x/exp/shiny/driver/gldriver in multiple modules:
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 (/home/me/go/pkg/mod/golang.org/x/exp@v0.0.0-20190731235908-ec7cb31e5a56/shiny/driver/gldriver)
golang.org/x/exp/shiny v0.0.0-20230203172020-98cc5a0785f9 (/home/me/go/pkg/mod/golang.org/x/exp/shiny@v0.0.0-20230203172020-98cc5a0785f9/driver/gldriver)
domain.com/project imports
github.com/hajimehoshi/ebiten/v2 imports
github.com/hajimehoshi/ebiten/v2/internal/ui imports
golang.org/x/mobile/app imports
golang.org/x/exp/shiny/screen: ambiguous import: found package golang.org/x/exp/shiny/screen in multiple modules:
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 (/home/me/go/pkg/mod/golang.org/x/exp@v0.0.0-20190731235908-ec7cb31e5a56/shiny/screen)
golang.org/x/exp/shiny v0.0.0-20230203172020-98cc5a0785f9 (/home/me/go/pkg/mod/golang.org/x/exp/shiny@v0.0.0-20230203172020-98cc5a0785f9/screen)
> go build
main.go:4:2: no required module provides package github.com/ebitenui/ebitenui; to add it:
go get github.com/ebitenui/ebitenui
main.go:5:2: no required module provides package github.com/hajimehoshi/ebiten/v2; to add it:
go get github.com/hajimehoshi/ebiten/v2 To test, use this one-liner: Workaround> # Retrieves ebiten/v2 (v2.4.16) instead of ebiten/v2 (v2.4.18)
> go get github.com/ebitenui/ebitenui
> # OR get ebiten/v2 (v2.4.18) directly, and add ebitenui from go mod tidy
> go get github.com/hajimehoshi/ebiten/v2; go mod tidy
Cause (?)
Proposed fixUpgrade |
So I just released a new version that is based on ebitengine's newest release 2.5.0. I believe that should resolve your issue. Let me know. I'm planning on closing this ticket in a few days unless there are any concerns that come up. |
No comments in the past month and a new version was released again v0.5.0. I am closing this issue. Please reopen if you still have concerns. |
Ambiguous import, cannot build example.
Error
Full example
The text was updated successfully, but these errors were encountered: