Finally I did it, looking a bit I found the escpos-php library of mike42.
https://github.com/mike42/escpos-php
The problem is that it uses php and I needed it in go, reviewing its code I discovered that it uses the copy function to send the file with the esc/pos code to the printer, unfortunately in go it is not that easy, but fortunately I found the page php2golang where I found a way to do it.
https://www.php2golang.com/method/function.copy.html
So, my final code is
func main () {
Copy ("printfile", "\\\\myPC\\\\POS-58-Series")
}
func Copy (source, dest string) (bool, error) {
fd1, err: = os.Open (source)
if err! = nil {
return false, err
}
defer fd1.Close ()
fd2, err: = os.OpenFile (dest, os.O_WRONLY | os.O_CREATE, 0644)
if err! = nil {
return false, err
}
defer fd2.Close ()
_, e: = io.Copy (fd2, fd1)
if e! = nil {
return false, e
}
return true, nil
}