On Thu, Apr 29, 2021 at 10:31:40AM +0200, Christian Schneider wrote:
>Hey,
>I run in an issue with your spf library. I expected err to be nil if
>no error happens. The docs does not say anything about it.
>
>Code:
>// should work
>ip := net.ParseIP("138.201.174.101")
>r, err := spf.CheckHost(ip, "
androidloves.me")
>fmt.Println("result", r, "err", err)
>
>// should not work
>ip = net.ParseIP("62.180.228.1")
>r, err = spf.CheckHost(ip, "
androidloves.me")
>fmt.Println("result", r, "err", err)
>
>
>Output:
>result pass err matched 'mx'
>result fail err matched 'all'
>
>
>The results are right, but err is not empty if no error occurs. Am I
>doing something wrong or whats the problem here?
>It's not what I was expecting/conforms to the Go standard.
You're not doing anything wrong. I agree it's unexpected/surprising, but
I didn't realize it was not properly documented, thank you for reporting
this!
I understand the usage of error here is not ideomatic, but it was a
tradeoff with keeping the API easier to use, given how SPF check results
already require non-trivial handling (as you know, it isn't a yes/no
answer, etc.).
I've made the following patch to document this behaviour, can you take a
look and let me know if it clarifies things a bit? Also let me know
(privately if you prefer) if you want to change your attribution.
https://blitiri.com.ar/git/r/spf/c/d29dbf32234c1c430b7ad62d876117ca73bbdfec/
>I'm also looking forward to the next version with the context support.
>Do you know when it will be released?
Now is a good time, since those changes have been out for a while :)
Once I'm happy enough with this documentation change, I'll make a
release and will let you know.
>Thanks for your effort.
Thanks to you for reporting this!
Alberto