forked from karalabe/hid
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dummy package for C sources directories to allow vendoring
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
- Loading branch information
Showing
13 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package hid | ||
|
||
// Just for Go vendoring | ||
// See https://github.com/golang/go/issues/26366 | ||
import _ "github.com/dolmen-go/hid/internal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
cd "$(dirname "$0")" | ||
|
||
for d in $(find libusb hidapi -type d) | ||
do | ||
echo "package $(basename $d)" >"$d/pkg.go" | ||
done | ||
|
||
pkg=$(cd ..; go list)/internal | ||
|
||
{ | ||
echo 'package internal' | ||
echo | ||
echo 'import (' | ||
for d in $(find hidapi libusb -type d); | ||
do | ||
printf '\t_ "%s/%s"\n' "$pkg" "$d" | ||
done | ||
echo ')' | ||
} >pkg.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package hidapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package libusb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package mac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package hidapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package libusb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package libusb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package internal | ||
|
||
import ( | ||
_ "github.com/dolmen-go/hid/internal/hidapi" | ||
_ "github.com/dolmen-go/hid/internal/hidapi/mac" | ||
_ "github.com/dolmen-go/hid/internal/hidapi/hidapi" | ||
_ "github.com/dolmen-go/hid/internal/hidapi/windows" | ||
_ "github.com/dolmen-go/hid/internal/hidapi/libusb" | ||
_ "github.com/dolmen-go/hid/internal/libusb" | ||
_ "github.com/dolmen-go/hid/internal/libusb/libusb" | ||
_ "github.com/dolmen-go/hid/internal/libusb/libusb/os" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,5 @@ if [[ -d hidapi ]]; then | |
fi | ||
mv $dir hidapi | ||
rm -Rf hidapi.orig "$archive" | ||
|
||
./dummy-packages.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,5 @@ if [[ -d libusb ]]; then | |
fi | ||
mv libusb-${version} libusb | ||
rm -Rf libusb.orig "$archive" | ||
|
||
./dummy-packages.sh |