You can't install specific package versions using Homebrew.
If you have a version installed you can pin it:
brew pin <package>
That will prevent a brew upgrade
from updating the package.
You can't install specific package versions using Homebrew.
If you have a version installed you can pin it:
brew pin <package>
That will prevent a brew upgrade
from updating the package.
Here is some problematic code...
func WriteJSON(l *slog.Logger, w http.ResponseWriter, r *http.Request, code int, v any) {
ctx := r.Context()
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
if err := json.NewEncoder(w).Encode(v); err != nil {
l.LogAttrs(ctx, slog.LevelError, "encode_json_response", slog.Any("err", err))
// This code demonstrates how iterators work in Go. | |
// This particular example is contrived, but I wanted something simple enough to demonstrate the point. | |
package main | |
import ( | |
"fmt" | |
"iter" | |
"strings" | |
) |
Guidelines:
Tip
The super quick summary is: use omitzero
Unless you need to identify an empty map/slice/interface, then use omitempty
.
If you need to identify if value was deliberately set to the zero type, use a pointer.
If you have specific zero requirements define custom type with IsZero
method.
omitzero
omitempty
func exampleHandler(w http.ResponseWriter, r *http.Request) { | |
defer func() { | |
if rec := recover(); rec != nil { | |
// The net/http server itself has a recovery mechanism that specifically looks for http.ErrAbortHandler. | |
// When it catches this particular panic, it knows to abort the current request handler and close the connection. | |
if rec == http.ErrAbortHandler { | |
log.Println("Handler aborted with http.ErrAbortHandler. Connection will be closed by server.") | |
} else { | |
log.Printf("Unhandled panic: %v.", rec) | |
} |
This glossary defines common terms related to Transport Layer Security (TLS), digital certificates, Certificate Authorities (CAs), and the Automatic Certificate Management Environment (ACME) protocol. It's intended to help users understand the concepts involved in securing services and using APIs that manage certificate issuance, particularly focusing on Subject Alternative Names (SANs).
https://pkg.go.dev/tailscale.com/util/ctxkey
Example Playground: https://play.golang.com/p/aZ0joNec3Xl
package main
import (
"context"
"fmt"
If a domain owner wants to use another company for handling DNS management over its domain, then they can update the "Name Servers" for their domain wherever DNS is currently managed, and set the Name Servers to a different DNS provider.
This is known as DNS delegation.
Once that Name Server change has propagated, the new DNS provider will be responsible for managing DNS records for the domain.
.
├── Makefile
├── cmd
│ └── api
│ └── main.go
├── go.mod
├── go.sum
├── internal
│ ├── api
// Package gob manages streams of gobs - binary values exchanged between an Encoder | |
// (transmitter) and a Decoder (receiver). | |
package main | |
import ( | |
"bytes" | |
"encoding/gob" | |
"fmt" | |
"log" | |
) |