Closed
Description
I wrote the pwned passwords into a bucket. Because I only need to know if the hash exists, I wrote an empty value into the bucket.
err := hashes.Put(hash, []byte{})
Now I tried to find a hash, but I had to realize that Go does not distinguish between an empty array and nil
. The problem is: Bolt returns nil
to indicate that a key does not exist. This is a problem because of Go's limitation.
How to store keys without values in order to check just for existence?
I think Bucket.Get needs to return an additional boolean or Bucket needs an additional function to check just for existence.
Go itself also indicates the existence of a key in a map by an additional boolean:
i, ok := m["route"]
Metadata
Metadata
Assignees
Labels
No labels