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

Fix go mod vendor #31

Closed
wants to merge 2 commits into from
Closed

Conversation

lionello
Copy link

@lionello lionello commented Mar 9, 2021

This works around golang/go#26366 by adding a dummy.go file in required folders. Without this fix, all C and H files will be missing from the vendor folder, causing the build to fail.

For another example, see Hywan/go-ext-wasm@4724910

This fixes golang/go#26366
by adding a dummy.go file in required folders.
@dolmen
Copy link
Contributor

dolmen commented Jan 13, 2022

Cosmetic suggestion: use the directory name as the dummy package name.

for d in $(find internal -type d); do echo "package $(basename $d)" >"$d/dummy.go"; done

dolmen added a commit to dolmen-go/hid that referenced this pull request Feb 20, 2022
To allow 'go mod -vendor' to take directories, we create dummy packages
in each directory.

Basically it does:
for d in $(find internal -type d); do echo "package $(basename $d)" >"$d/pkg.go"; done

A script is used to maintained those dummy package besides hidapi/libusb
upgrades: internal/dummy-packages.sh

See:
- karalabe#31
- golang/go#26366
@dolmen
Copy link
Contributor

dolmen commented Feb 20, 2022

Well, this doesn't fix the issue.

Here is what we get with go build: C source files not allowed when not using cgo or SWIG

@lionello lionello closed this Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants