| https://twitter.com/wolfeidau | |
| Github | https://github.com/wolfeidau |
| Blog | https://www.wolfe.id.au |
| https://twitter.com/wolfeidau | |
| Github | https://github.com/wolfeidau |
| Blog | https://www.wolfe.id.au |
Quick Go Tip: Always create a custom HTTP client
Go's net/http package provides convenient Get, Post, and other HTTP method as top-level package functions:
resp, err := http.Get("http://example•com/")
While these are great for prototyping and quick throwaway scripts, don't use them in production.
Reason: They don't time out.
Instead, create an http.Client and set its Timeout field. It's almost as easy as using top-level HTTP calls:
client := &http.Client{
Timeout: 10* time.Second,
}
resp, err := client.Get("http://example•com")
Thanks to a couple contributors, Ghostty has built-in VCS branching characters. Kitty introduced this[1] and I think Ghostty is the second terminal to implement it. The cool detail in this one: for the end markers they're drawn with a true fade (see line 13).