Skip to content

tpl/collections: Require collections.D args to be ints #13952

@jmooring

Description

@jmooring

Change this:

func (ns *Namespace) D(seed, n, hi any) []int {
	key := dKey{seed: cast.ToUint64(seed), n: cast.ToInt(n), hi: cast.ToInt(hi)}

To this:

func (ns *Namespace) D(seed, n, hi int) []int {
	key := dKey{seed: cast.ToUint64(seed), n: n, hi: hi}

Why? To avoid stupid mistakes like the one I just made, inadvertently doing this:

{{ collections.D (hash.XxHash .Path) 7 42 }}

Instead of this:

{{ collections.D (hash.FNV32a .Path) 7 42 }}

So regardless of page I was getting the same result.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions