Tag go

 Like

Liked Go generics are not bad
Post details
When programming, we often need to write ‘generic’ functions where the exact data type is not important. For example, you might want to write a simple function that sums up numbers. Go lacked this notion until recently, but it was recently added (as of version 1.18). So I took it out for a spin. In … Continue reading Go generics are not bad

 Like

Liked Nicer struct literals in Go templates by Josh Bleecher Snyder 
Post details
Go templates (text/template, html/template) accept a single argument to render. That’s generally enough when you’re executing them from Go code. But when invoking a template from another template, you often want to pass multiple things to it. For example, we might have a template that renders a nav bar item. It requires a title, a url, and an “enabled” bool. We want to invoke it from another template. How do you do that?

 Like

Liked Go: Tracing HTTP requests
Post details
The HTTP protocol is fast, secure, and reliable. However, it needs other protocols and services to work properly, and when things don’t go well it is necessary to have access to detailed information about the time spent in each step. The steps to make an HTTP call are as follows: DNS Lookup The client sends a DNS query to the DNS server. The DNS server responds with the IP for the name.