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

Add dummy Go packages for vendoring of C files #17

Merged
merged 2 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// +build dummy

// This file is part of a workaround for `go mod vendor` which won't vendor
// C files if there's no Go file in the same directory.
// This would prevent the hidapi/hidapi/hidapi.h file to be vendored.
//
// This Go file imports the c directory where there is another dummy.go file which
// is the second part of this workaround.
//
// These two files combined make it so `go mod vendor` behaves correctly.
//
// See this issue for reference: https://github.com/golang/go/issues/26366

package main

import (
_ "github.com/karalabe/usb/hidapi"
_ "github.com/karalabe/usb/hidapi/hidapi"
_ "github.com/karalabe/usb/hidapi/libusb"
_ "github.com/karalabe/usb/hidapi/mac"
_ "github.com/karalabe/usb/hidapi/windows"
_ "github.com/karalabe/usb/libusb"
_ "github.com/karalabe/usb/libusb/libusb"
_ "github.com/karalabe/usb/libusb/libusb/os"
)
7 changes: 7 additions & 0 deletions hidapi/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build dummy

// Package c contains only a C file.
//
// This Go file is part of a workaround for `go mod vendor`.
// Please see the file dummy.go at the root of the module for more information.
package hidapi
7 changes: 7 additions & 0 deletions hidapi/hidapi/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build dummy

// Package c contains only a C file.
//
// This Go file is part of a workaround for `go mod vendor`.
// Please see the file dummy.go at the root of the module for more information.
package hidapi
7 changes: 7 additions & 0 deletions hidapi/libusb/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build dummy

// Package c contains only a C file.
//
// This Go file is part of a workaround for `go mod vendor`.
// Please see the file dummy.go at the root of the module for more information.
package libusb
7 changes: 7 additions & 0 deletions hidapi/mac/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build dummy

// Package c contains only a C file.
//
// This Go file is part of a workaround for `go mod vendor`.
// Please see the file dummy.go at the root of the module for more information.
package mac
7 changes: 7 additions & 0 deletions hidapi/windows/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build dummy

// Package c contains only a C file.
//
// This Go file is part of a workaround for `go mod vendor`.
// Please see the file dummy.go at the root of the module for more information.
package windows
7 changes: 7 additions & 0 deletions libusb/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build dummy

// Package c contains only a C file.
//
// This Go file is part of a workaround for `go mod vendor`.
// Please see the file dummy.go at the root of the module for more information.
package libusb
7 changes: 7 additions & 0 deletions libusb/libusb/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build dummy

// Package c contains only a C file.
//
// This Go file is part of a workaround for `go mod vendor`.
// Please see the file dummy.go at the root of the module for more information.
package libusb
7 changes: 7 additions & 0 deletions libusb/libusb/os/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build dummy

// Package c contains only a C file.
//
// This Go file is part of a workaround for `go mod vendor`.
// Please see the file dummy.go at the root of the module for more information.
package os