If possible, I would like to write a Go program that does the following:
1. Calls http.ListenAndServe() or http.ListenAndServeTLS() (in its own goroutine, of course)
2. Waits until http.ListenAndServe() or http.ListenAndServeTLS() is accepting connections
3. Starts a web browser pointed at the host and port sent to http.ListenAndServe() or http.ListenAndServeTLS()
Steps #1 and #3 are, of course, no problem. #2 is a little more difficult.
Of course, calling http.Serve() is an option, and works great as an alternative to the http.ListenAndServe() function.
However, replacing http.ListenAndServeTLS() presents a lot more difficulty... I'm looking for solutions that aren't a giant copy and paste of the source, modified for my needs, and updated each time a new release of Go comes out.
Any suggestions are appreciated, thanks!