If you want an easy copy and paste, no nonsense way to print the output of a COM PORT to the terminal in go, then have a look at the code at the bottom of this post.
Firstly, the go.bug.st/serial/enumerator package provides a very nice interface for getting details of connected devices, and includes more details than the example code in go.bug.st/serial that I found first time around.
Thanks to the toit devs for being responsive and helping me quickly figure out how I could make my ESP spit some USB content out over the COM port.
The code
In a nutshell is this:
- Loops forever
- Targets a specific device ID, such a
1a86:7523 - Waits for it to appear as connected
- Uses baud rate 115200
- Opens the port
- Prints all output received to the console
