package util

import "golang.org/x/tools/internal/mcp/internal/util"

Index

Functions

func KeySlice

func KeySlice[M ~map[K]V, K comparable, V any](m M) []K

KeySlice returns the keys of the map M, like slices.Collect(maps.Keys(m)).

func Sorted

func Sorted[M ~map[K]V, K cmp.Ordered, V any](m M) iter.Seq2[K, V]

Sorted returns an iterator over the entries of m in key order.

func Wrapf

func Wrapf(errp *error, format string, args ...any)

Wrapf wraps *errp with the given formatted message if *errp is not nil.

Types

type JSONInfo

type JSONInfo struct {
	Omit     bool            // unexported or first tag element is "-"
	Name     string          // Go field name or first tag element. Empty if Omit is true.
	Settings map[string]bool // "omitempty", "omitzero", etc.
}

func FieldJSONInfo

func FieldJSONInfo(f reflect.StructField) JSONInfo

FieldJSONInfo reports information about how encoding/json handles the given struct field. If the field is unexported, JSONInfo.Omit is true and no other JSONInfo field is populated. If the field is exported and has no tag, then Name is the field's name and all other fields are false. Otherwise, the information is obtained from the tag.

Source Files

util.go

Version
v0.36.0
Published
Aug 7, 2025
Platform
darwin/amd64
Imports
6 packages
Last checked
3 hours ago

Tools for package owners.