I have a thermal printer(ESC/POS) already configured on my linux machine and using the terminal command (as root) I can make it print:
echo "Hello!" > /dev/usb/lp0
However, doing the same procedure in golang nothing happens:
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println("Hello Would!")
f, err := os.Open("/dev/usb/lp0")
if err != nil {
panic(err)
}
defer f.Close()
f.Write([]byte("Hello world!"))
}
What am I doing wrong?