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

Comparing uninitialized maps to nil #45

akyoto opened this issue May 20, 2019 · 3 comments


None yet
2 participants
Copy link

commented May 20, 2019

This looks like a bug:

var shouldBeNil map[string]interface{}

if shouldBeNil == nil {
	c.Log("Indeed nil, according to Go")

c.Assert(shouldBeNil, qt.Equals, nil)

It generates:

Indeed nil, according to Go

          values are not equal
          map[string]interface {}{}

This comment has been minimized.

Copy link

commented May 20, 2019

Nevermind, I should have taken a look at qt.IsNil.

However, does this still look like something you'd want to address or is this behaviour "by design"?
If it is, feel free to close.


This comment has been minimized.

Copy link

commented May 20, 2019

Yes it is by design, see [0]. This way it is possible to check that something is actually nil or use IsNil for a less strict check.

@frankban frankban closed this May 20, 2019


This comment has been minimized.

Copy link

commented May 21, 2019

I see, so that's why both are needed. A strict and a less strict version.
Thank you for the clarification @frankban!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.