Standard library / log/slog

slog.Attr.Equal()

Compare attribute keys and values using Value.Equal. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (a Attr) Equal(b Attr) bool

Parameters & Attributes

NameTypeDescription
bAttrInput to the operation as described above.

Return Value

bool

Compare attribute keys and values using Value.

Working Example

Example Snippetgo
package main
import (  "fmt"  "log/slog")
func main() { fmt.Println(slog.Int("n", 2).Equal(slog.Int("n", 2))) }
Go Reference