Standard library / log/slog

slog.Value.Equal()

Compare values according to their kinds and contents; non-comparable Any payloads can panic. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) Equal(w Value) bool

Parameters & Attributes

NameTypeDescription
wValueWriter receiving log records.

Return Value

bool

Compare values according to their kinds and contents; non-comparable Any payloads can panic.

Working Example

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