On Thu, Feb 20, 2025 at 1:06 PM Lin Lin <linsite.thin...@gmail.com> wrote:
> I think that's a little conflict with Go's convention. If the error is
nil, one can be sure any returned Object is good. In this case, how can the
caller trust the result? Or we can improve the doc to explain a bit more. I
believe most Go developers will not notice that pitfall before one step
into it. In my experience, I ran into that by calling http.NewRequest with
a bad URL, the url.Parse is hidden inside, which is even less likely to be
noticed.

The result _is_ good.

jnml@e5-1650:~/tmp/url$ ls -la
total 8
drwxr-xr-x  2 jnml jnml 4096 Feb 20 13:09 .
drwxr-xr-x 22 jnml jnml 4096 Feb 20 13:08 ..
jnml@e5-1650:~/tmp/url$ mkdir -p http:/127.0.0.1
jnml@e5-1650:~/tmp/url$ echo foo > http:/127.0.0.1/index.html
jnml@e5-1650:~/tmp/url$ ls -la http:/127.0.0.1/index.html
-rw-r--r-- 1 jnml jnml 4 Feb 20 13:10 http:/127.0.0.1/index.html
jnml@e5-1650:~/tmp/url$ cat http:/127.0.0.1/index.html
foo
jnml@e5-1650:~/tmp/url$

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-Vorzcm87c6ntUiEtYfmkw8RTfUvadED3wcfFZqeKnvzw%40mail.gmail.com.

Reply via email to