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

Unable to detect `nil` explicitly in conditionals #5905

Closed
RealOrangeOne opened this issue Apr 27, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@RealOrangeOne
Copy link
Contributor

commented Apr 27, 2019

After the last update to 0.55, i'm no longer able to specify if a value is equal to nil. This is especially useful when combined with where. https://gohugo.io/functions/where/#unset-fields defines this as possible, although the example is using .Params, which I guess behaves slightly differently.

For example, given a page

<p>{{ .Parent }}</p>
<p>{{ eq .Parent nil }}</p>
<p>{{ .File }}</p>
<p>{{ .Permalink }}</p>

yields

<nil>
false
tags/arch/_index.md
http://localhost:1313/tags/arch/

Doing {{ if .Parent }} acts false, as expected, meaning it seems nil != nil in this new release.

After some naive researching, https://dev.to/pauljlucas/go-tcha-when-nil--nil-hic might have something to do with this?

@bep bep added the Bug label Apr 27, 2019

@bep bep modified the milestones: v0.56, v0.55.5 Apr 27, 2019

bep added a commit to bep/hugo that referenced this issue Apr 29, 2019

bep added a commit to bep/hugo that referenced this issue Apr 29, 2019

@bep bep closed this in #5909 Apr 29, 2019

bep added a commit that referenced this issue Apr 29, 2019

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.