cimgui-go icon indicating copy to clipboard operation
cimgui-go copied to clipboard

go mod tidy fails because of ImGuiColorTextEdit/vendor

Open gucio321 opened this issue 1 year ago • 21 comments

...
go: finding module for package github.com/AllenDang/cimgui-go/cwrappers/ImGuiColorTextEdit/vendor/regex/test/pathology
go: finding module for package github.com/AllenDang/cimgui-go/cwrappers/ImGuiColorTextEdit/vendor/regex/test/regress
go: finding module for package github.com/AllenDang/cimgui-go/cwrappers/ImGuiColorTextEdit/vendor/regex/test/unicode
go: finding module for package github.com/AllenDang/cimgui-go/cwrappers/ImGuiColorTextEdit/vendor/regex/tools/generate
go: finding module for package github.com/AllenDang/cimgui-go/cwrappers/ImGuiColorTextEdit/vendor/regex/test/static_mutex
go: github.com/AllenDang/giu imports
	github.com/AllenDang/cimgui-go/imgui imports
	github.com/AllenDang/cimgui-go imports
	github.com/AllenDang/cimgui-go/cwrappers/ImGuiColorTextEdit/vendor/regex/build: module github.com/AllenDang/cimgui-go@latest found (v1.2.0), but does not contain package github.com/AllenDang/cimgui-go/cwrappers/ImGuiColorTextEdit/vendor/regex/build
...

gucio321 avatar Nov 12 '24 16:11 gucio321

it complains only about vendor direcctories so my assume is that since vendor is a special GO name, it has problem about it.

gucio321 avatar Nov 12 '24 16:11 gucio321

some details in https://github.com/gucio321/vendor-package-issue

gucio321 avatar Nov 12 '24 18:11 gucio321

according to https://github.com/golang/go/issues/70303 it was fixed in https://github.com/golang/go/issues/37397 just a month ago and will be present in next go release 1.24.

gucio321 avatar Nov 12 '24 22:11 gucio321

Any workaround at the moment?

FinecoFinit avatar Nov 14 '24 10:11 FinecoFinit

@FinecoFinit I don't know any yet. Does this affect your project anyhow? (e.g giu works without go mod tidy)

gucio321 avatar Nov 14 '24 14:11 gucio321

@gucio321 I can't import it, missing in indexes, or I need to pull it with go get?

FinecoFinit avatar Nov 14 '24 14:11 FinecoFinit

you should go get. It works for me on isolated env

FROM golang:latest
RUN mkdir /myproject
WORKDIR /myproject
RUN go mod init example.com
RUN go get github.com/AllenDang/cimgui-go
ENTRYPOINT /bin/bash

and it works

gucio321 avatar Nov 14 '24 17:11 gucio321

Still asks to run go mod tidy:

go: updates to go.mod needed; to update it:
	go mod tidy

Compilation finished with exit code 1

FinecoFinit avatar Nov 15 '24 04:11 FinecoFinit

If this is on ci try running go get locally. Note that we require go1.23

gucio321 avatar Nov 15 '24 05:11 gucio321

I use Goland from local environment

FinecoFinit avatar Nov 15 '24 05:11 FinecoFinit

As I said above I'm able to do this from a clean enviroument. Can I see your go mod and a command you're executing

gucio321 avatar Nov 15 '24 06:11 gucio321

Command: go run -ldflags "-s -w -H=windowsgui -extldflags=-static" .\main.go go.mod:

module ReMigo

go 1.23.3

require (
	github.com/gocolly/colly/v2 v2.1.0
	golang.org/x/sys v0.27.0
	gopkg.in/yaml.v3 v3.0.1
)

require (
	github.com/AllenDang/cimgui-go v1.2.0 // indirect
	github.com/AllenDang/giu v0.11.0 // indirect
	github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 // indirect
	github.com/PuerkitoBio/goquery v1.10.0 // indirect
	github.com/andybalholm/cascadia v1.3.2 // indirect
	github.com/antchfx/htmlquery v1.3.3 // indirect
	github.com/antchfx/xmlquery v1.4.2 // indirect
	github.com/antchfx/xpath v1.3.2 // indirect
	github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 // indirect
	github.com/gobwas/glob v0.2.3 // indirect
	github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
	github.com/gucio321/glm-go v0.0.0-20241029220517-e1b5a3e011c8 // indirect
	github.com/kennygrant/sanitize v1.2.4 // indirect
	github.com/mazznoer/csscolorparser v0.1.5 // indirect
	github.com/napsy/go-css v0.0.0-20230611142900-9dd118f3874c // indirect
	github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
	github.com/sahilm/fuzzy v0.1.1 // indirect
	github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
	github.com/temoto/robotstxt v1.1.2 // indirect
	golang.design/x/hotkey v0.4.1 // indirect
	golang.design/x/mainthread v0.3.0 // indirect
	golang.org/x/image v0.22.0 // indirect
	golang.org/x/net v0.31.0 // indirect
	golang.org/x/text v0.20.0 // indirect
	google.golang.org/appengine v1.6.8 // indirect
	google.golang.org/protobuf v1.35.2 // indirect
	gopkg.in/eapache/queue.v1 v1.1.0 // indirect
)

FinecoFinit avatar Nov 15 '24 06:11 FinecoFinit

Try go get first

go get github.com/AllenDang/[email protected]

gucio321 avatar Nov 15 '24 06:11 gucio321

Same, asking for go mod tidy

FinecoFinit avatar Nov 15 '24 06:11 FinecoFinit

What's strange is that your go.mod days that everything about AllenDang is markedindirect

Maybe try to manually remove that and rerun go get

gucio321 avatar Nov 15 '24 06:11 gucio321

Resolved with:

  1. remove all giu related code
  2. go mod tidy
  3. go get github.com/AllenDang/giu/
  4. include all giu code back

FinecoFinit avatar Nov 15 '24 06:11 FinecoFinit

Could you show your gomod now(just to see a diff)

gucio321 avatar Nov 15 '24 06:11 gucio321

Sure bud:

module ReMigo

go 1.23.3

require (
	github.com/gocolly/colly/v2 v2.1.0
	golang.org/x/sys v0.27.0
	gopkg.in/yaml.v3 v3.0.1
)

require (
	github.com/AllenDang/cimgui-go v1.2.0 // indirect
	github.com/AllenDang/giu v0.11.0 // indirect
	github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 // indirect
	github.com/PuerkitoBio/goquery v1.10.0 // indirect
	github.com/andybalholm/cascadia v1.3.2 // indirect
	github.com/antchfx/htmlquery v1.3.3 // indirect
	github.com/antchfx/xmlquery v1.4.2 // indirect
	github.com/antchfx/xpath v1.3.2 // indirect
	github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 // indirect
	github.com/gobwas/glob v0.2.3 // indirect
	github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
	github.com/golang/protobuf v1.5.2 // indirect
	github.com/gucio321/glm-go v0.0.0-20241029220517-e1b5a3e011c8 // indirect
	github.com/kennygrant/sanitize v1.2.4 // indirect
	github.com/mazznoer/csscolorparser v0.1.5 // indirect
	github.com/napsy/go-css v0.0.0-20221107082635-4ed403047a64 // indirect
	github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
	github.com/sahilm/fuzzy v0.1.1 // indirect
	github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
	github.com/stretchr/testify v1.9.0 // indirect
	github.com/temoto/robotstxt v1.1.2 // indirect
	golang.design/x/hotkey v0.4.1 // indirect
	golang.design/x/mainthread v0.3.0 // indirect
	golang.org/x/image v0.22.0 // indirect
	golang.org/x/net v0.31.0 // indirect
	golang.org/x/text v0.20.0 // indirect
	google.golang.org/appengine v1.6.8 // indirect
	google.golang.org/protobuf v1.35.2 // indirect
	gopkg.in/eapache/queue.v1 v1.1.0 // indirect
)

FinecoFinit avatar Nov 15 '24 06:11 FinecoFinit

so i was probably a problem in your go.sum which couldn't be fixe due to cimgui-go issue.

here is go.mod's diff
        github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 // indirect
        github.com/gobwas/glob v0.2.3 // indirect
        github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
+       github.com/golang/protobuf v1.5.2 // indirect
        github.com/gucio321/glm-go v0.0.0-20241029220517-e1b5a3e011c8 // indirect
        github.com/kennygrant/sanitize v1.2.4 // indirect
        github.com/mazznoer/csscolorparser v0.1.5 // indirect
-       github.com/napsy/go-css v0.0.0-20230611142900-9dd118f3874c // indirect
-       github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
+       github.com/napsy/go-css v0.0.0-20221107082635-4ed403047a64 // indirect
+       github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
        github.com/sahilm/fuzzy v0.1.1 // indirect
        github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
+       github.com/stretchr/testify v1.9.0 // indirect
        github.com/temoto/robotstxt v1.1.2 // indirect
        golang.design/x/hotkey v0.4.1 // indirect
        golang.design/x/mainthread v0.3.0 // indirect

sorry for this problem here. Unfortunately we need to wait for golang/go to release.

gucio321 avatar Nov 15 '24 06:11 gucio321

still does not work for giu.

gucio321 avatar Feb 13 '25 12:02 gucio321

Hay everyone! I'm going to patch this vendor stuff soon. I lost a hope to see this fixed in golang in a reasonable time. To sumarize the solution I was waiting for before: golang's fix was meant for package paths ending with /vendor but not containing vendor (why the hell they did that difference???). The new tracking issue is https://github.com/golang/go/issues/71785 .

My fix is to temporarily rename all vendor directories in cwrappers to vendor1. The only place when it happens is in ImGuiColorTextEdit where the maintainer put regex library in directory called vendor. To be honest this directory is not explicitly mentioned in the code, so the name doesn't matter at all (g++ searches for dependencies in the current directory tree).

This single fix is not too complex (in fact I have it done on my branch already). The problem is that to PR it correctly, I want to check if it works with make update. This guy however has some issues as a couple of things changed since last updates. (you know, things like newly added PlatformIO function which conflicts with PlatformIO type and needs to be renamed to CurrentPlatformIO and so on - more in the upcoming PR).

Currently I'm waiting for a certain bugfix in cimCTE upstream, but I should be done next week.

gucio321 avatar Mar 14 '25 09:03 gucio321