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

net: LookupIP and LookupHost on empty string use domain name #8271

gopherbot opened this issue Jun 23, 2014 · 5 comments

net: LookupIP and LookupHost on empty string use domain name #8271

gopherbot opened this issue Jun 23, 2014 · 5 comments


Copy link

@gopherbot gopherbot commented Jun 23, 2014


What does 'go version' print?
go version devel +ee11f19bc514 Mon Jun 23 18:46:01 2014 +0900 openbsd/amd64

What steps reproduce the problem?
If possible, include a link to a program on

package main

import (

func main() {
        s, err := net.LookupHost("")
        fmt.Printf("%v %v\n", s, err)

        ip, err := net.LookupIP("")
        fmt.Printf("%v %v\n", ip, err)

        mx, err := net.LookupMX("")
        fmt.Printf("%v %v\n", mx, err)

What happened?
[2001:470:c049::162] <nil>
[2001:470:c049::162] <nil>
[] lookup : invalid domain name

What should have happened instead?

All Lookup's should have failed with invalid hostname/domainname

Please provide any additional information below.
OpenBSD 5.5 GENERIC.MP#0 amd64
Copy link

@ianlancetaylor ianlancetaylor commented Jun 23, 2014

Comment 1:

Labels changed: added repo-main, release-go1.4.

Copy link

@4a6f656c 4a6f656c commented Jul 3, 2014

Comment 2:

I highly doubt that this is a Go specific issue - the net package is only calling
C.getaddrinfo via cgo. My guess is that a pure C program will behave in the same manner
(most likely related to the new OpenBSD ASR, combined with your resolv.conf

Owner changed to @4a6f656c.

Status changed to WaitingForReply.

Copy link

@rsc rsc commented Sep 16, 2014

Comment 3:

Is that your local IP address,
I think that's semi-standard for putting no host in.
It's the same reason that listening to ":12345" really means "listen to local IP address
on that port".
It's a bit odd but I think it's correct.
Copy link

@gopherbot gopherbot commented Sep 16, 2014

Comment 4 by

This can be closed anyhow; it was fixed in OpenBSD.
Copy link

@4a6f656c 4a6f656c commented Sep 16, 2014

Comment 5:

This was a bug/change in behaviour in the new OpenBSD ASR that has since been fixed (in
OpenBSD). From a Go perspective things were working as intended.

Status changed to WorkingAsIntended.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.