types/hash.go

go · src/go/types/hash.go · go · BSD-3-Clause
dev-tools

Provides hashing and equality for Go type objects, used in type comparison.

// Source: https://github.com/golang/go | License: BSD-3-Clause | Copyright 2009 The Go Authors
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package types

// This file defines a hash function for Types.

import (
	"fmt"
	"hash/maphash"
)

type (
	// Hasher defines a hash function and equivalence relation
	// for [Types] that is consistent with [Identical].
	// Hashers are stateless.
	Hasher struct{}

	// HasherIgnoreTags is a variant of [Hasher] that is
	// consistent with [IdenticalIgnoreTags].
	HasherIgnoreTags struct{}
)

var (
	_ maphash.Hasher[Type] = Hasher{}
	_ maphash.Hasher[Type] = HasherIgnoreTags{}
)


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key