Documentation
¶
Index ¶
- func FreePort(port int)
- func OpenBrowser(target string)
- func Run(name string, args ...string) error
- func RunWithEnv(env map[string]string, name string, args ...string) error
- func StartBackground(ctx context.Context, env map[string]string, name string, args ...string) (*exec.Cmd, error)
- func WaitForURL(urlStr string, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FreePort ¶ added in v0.2.0
func FreePort(port int)
FreePort releases a TCP port before a service binds to it, so two independent godev projects on the same machine (e.g. two microservices, each defaulting to :5432/:3000) don't have to coordinate port numbers by hand.
It first checks whether a Docker container — from this project or any other — is currently publishing that exact port, and if so stops just that one container (docker stop, never a teardown of its whole stack). Only when no container owns the port does it fall back to killing a bare local process on it, and even then it refuses to touch anything that looks like the container engine itself (see dockerEngineProcessNames).
func OpenBrowser ¶
func OpenBrowser(target string)
OpenBrowser opens a file or URL in the default browser (preferring Google Chrome on Mac)
func RunWithEnv ¶
RunWithEnv executes a command with additional environment variables
Types ¶
This section is empty.