Skip to content
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

mod/vendor: broken support for git-submodules in vendoring mode #56920

Closed
gucio321 opened this issue Nov 23, 2022 · 8 comments
Closed

mod/vendor: broken support for git-submodules in vendoring mode #56920

gucio321 opened this issue Nov 23, 2022 · 8 comments

Comments

@gucio321
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
go version go1.19.2 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mszeptuch/.cache/go-build"
GOENV="/home/mszeptuch/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/mszeptuch/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mszeptuch/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4114909537=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Hi there!
I'm using giu with docking branch.
This branch uses cimgui-go that is a bit complex construct.
in short, it wraps C version of DearImGui
The cimgui is added to cimgui-go as a git submodule.
Everything works fine, until using a global modules system..
But after running go mod vendor, CGO complains about missing C includes - submodule doesn't get into vendor directory somehow.

What did you expect to see?

dependencies should be fully cloned into vendor directory

What did you see instead?

git modules that are a part of go module are missing in vendoring mode

@gucio321
Copy link
Contributor Author

to reproduce

  • git clone https://github.com/AllenDang/giu
  • cd giu/examples/helloworld
  • git checkout docking
  • go run .
  • everyghing works fine
  • go mod vendor
  • go run .
  • compiler's crash

@seankhliao
Copy link
Member

Working as intended, vendoring only includes directories with .go files that are included in the build.
Notably, it does not directly use git clone anywhere.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2022
@gucio321
Copy link
Contributor Author

gucio321 commented Nov 23, 2022

@seankhliao so would it be possible to transfer this bug report into a proposal?
E.g like mod/vendor: check for cgo dependencies

Or it is better me to open a new issue?

@seankhliao
Copy link
Member

No, we've decided this is not something we will support, see #26366 (comment)

@gucio321
Copy link
Contributor Author

@seankhliao are you sure this comment is still up to data?
as far as I can see, sometimes some subdirectories that does not contain go files are included in vendor dir:

[assets (0) ]$ pwd;tree
/home/me/git/my-project/vendor/github.com/TheGreaterHeptavirate/ConstiTutor/internal/assets
.
├── assets.go
├── css
│   └── stylesheet.css
├── fonts
│   └── times_new_roman
│       ├── times_new_roman_bold.ttf
│       └── times_new_roman.ttf
├── icons
│   ├── 1.png
│   └── icon.png
└── sounds
    └── click.mp3

5 directories, 7 files

@seankhliao
Copy link
Member

Those are presumably referenced via //go:embed

@gucio321
Copy link
Contributor Author

So maybe cgo includes could be processed the same way??

@seankhliao
Copy link
Member

The issues with finding C dependencies described in #26366 remain the same, nothing has changed on that front.
//go:embed well defined (since Go is in control of it) so it is easy to support.

@golang golang locked and limited conversation to collaborators Nov 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants