Simple API to detect USB Storage device for Go. Works OS X, Linux and (with some issues, see note below) on Windows.
Check the example folder.
On Windows, we use the following command to detect removable media on the system:
wmic logicaldisk where drivetype=2 get deviceid
This checks for a special bit descriptor on the flash drive which indicates that the USB flash drive is a removable device. This should work as expected on most new flash drives. On some older drives, this bit may not be set leading to drives getting recognized as a local disk instead of a removable drive, which can lead to a false negative.
The code was inspired by USB Drive Detector, which is written for Java.