Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

take equals instead of == #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

flaneur2020
Copy link

hi Ric,

I tries take advantage of goskiplist as a sorted set in my part time project, but got this error:

panic: runtime error: comparing uncomparable type FileMeta

goroutine 36 [running]:
testing.tRunner.func1(0xc00018e100)
	/usr/local/Cellar/go/1.12/libexec/src/testing/testing.go:830 +0x388
panic(0x12e38a0, 0xc0000a0da0)
	/usr/local/Cellar/go/1.12/libexec/src/runtime/panic.go:522 +0x1b5
github.com/Fleurer/miaomiao/util/goskiplist/skiplist.(*SkipList).Set(0xc0000a2c90, 0x1310a00, 0xc0000b2f40, 0x0, 0x0)
	/Users/fleuria/night/miaomiao/util/goskiplist/skiplist/skiplist.go:416 +0x62a
github.com/fleurer/miaomiao/util/goskiplist/skiplist.(*Set).Add(...)
	/Users/fleuria/night/miaomiao/util/goskiplist/skiplist/skiplist.go:596
github.com/Fleurer/miaomiao/tool.(*Builder).Apply(0xc00019a000, 0xc00004bed8)
	/Users/fleuria/night/miaomiao/tool/builder.go:67 +0x31d
...

FileMeta is a struct so it can not be compared using ==/!=. I've noticed there's a comment about this: Additionally, Ordered instances should behave properly when compared using == and !=. But maybe it's possible to use the lessThan function to get the equality between the values?

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant