Skip to content

Commit

Permalink
Add dummy Go packages for vendoring of C files (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveruckdashel committed Oct 5, 2021
1 parent 4ea2095 commit 4c5740d
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 0 deletions.
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

0 comments on commit 4c5740d

Please sign in to comment.