From 4c5740d64559c5fe8ad36835d42c7f44ff4d1db9 Mon Sep 17 00:00:00 2001 From: Steve Ruckdashel Date: Tue, 5 Oct 2021 06:15:34 -0600 Subject: [PATCH] Add dummy Go packages for vendoring of C files (#17) --- dummy.go | 25 +++++++++++++++++++++++++ hidapi/dummy.go | 7 +++++++ hidapi/hidapi/dummy.go | 7 +++++++ hidapi/libusb/dummy.go | 7 +++++++ hidapi/mac/dummy.go | 7 +++++++ hidapi/windows/dummy.go | 7 +++++++ libusb/dummy.go | 7 +++++++ libusb/libusb/dummy.go | 7 +++++++ libusb/libusb/os/dummy.go | 7 +++++++ 9 files changed, 81 insertions(+) create mode 100644 dummy.go create mode 100644 hidapi/dummy.go create mode 100644 hidapi/hidapi/dummy.go create mode 100644 hidapi/libusb/dummy.go create mode 100644 hidapi/mac/dummy.go create mode 100644 hidapi/windows/dummy.go create mode 100644 libusb/dummy.go create mode 100644 libusb/libusb/dummy.go create mode 100644 libusb/libusb/os/dummy.go diff --git a/dummy.go b/dummy.go new file mode 100644 index 0000000..f6bbdc3 --- /dev/null +++ b/dummy.go @@ -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" +) diff --git a/hidapi/dummy.go b/hidapi/dummy.go new file mode 100644 index 0000000..647380f --- /dev/null +++ b/hidapi/dummy.go @@ -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 diff --git a/hidapi/hidapi/dummy.go b/hidapi/hidapi/dummy.go new file mode 100644 index 0000000..647380f --- /dev/null +++ b/hidapi/hidapi/dummy.go @@ -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 diff --git a/hidapi/libusb/dummy.go b/hidapi/libusb/dummy.go new file mode 100644 index 0000000..20d44a7 --- /dev/null +++ b/hidapi/libusb/dummy.go @@ -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 diff --git a/hidapi/mac/dummy.go b/hidapi/mac/dummy.go new file mode 100644 index 0000000..9e519ac --- /dev/null +++ b/hidapi/mac/dummy.go @@ -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 diff --git a/hidapi/windows/dummy.go b/hidapi/windows/dummy.go new file mode 100644 index 0000000..d72069e --- /dev/null +++ b/hidapi/windows/dummy.go @@ -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 diff --git a/libusb/dummy.go b/libusb/dummy.go new file mode 100644 index 0000000..20d44a7 --- /dev/null +++ b/libusb/dummy.go @@ -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 diff --git a/libusb/libusb/dummy.go b/libusb/libusb/dummy.go new file mode 100644 index 0000000..20d44a7 --- /dev/null +++ b/libusb/libusb/dummy.go @@ -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 diff --git a/libusb/libusb/os/dummy.go b/libusb/libusb/os/dummy.go new file mode 100644 index 0000000..7605504 --- /dev/null +++ b/libusb/libusb/os/dummy.go @@ -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