Skip to content

net: pure Go resolver(netdns) can not resolve hostname.local #35067

Closed as not planned
@atlas-comstock

Description

@atlas-comstock

What version of Go are you using (go version)?

go version go1.13.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/atlas/Library/Caches/go-build"
GOENV="/Users/atlas/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/yonghao.hu/mycode/go_dir_path"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/yonghao.hu/mycode/go_dir_path/src/test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wf/nw471wh91nj2j_dsrfrk4htnjtqhhw/T/go-build666420423=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

package main

import (
	"fmt"
	"net"
)

func main() {
	dialer := &net.Dialer{
		LocalAddr: nil,
	}

	_, err := dialer.Dial("tcp", "atalas-mac.local:4150")
	if err != nil {
		fmt.Println("resolve atalas-mac.local failed: ", err)
	} else {
		fmt.Println("resolve myaliashost success")
	}
	_, err = dialer.Dial("tcp", "myaliashost:4150")
	if err != nil {
		fmt.Println("resolve myaliashost failed: ", err)
	}
	fmt.Println("resolve myaliashost success")
}

Just run GODEBUG=netdns=go+4 go run test.go

What did you expect to see?

Resolve to 127.0.0.1

What did you see instead?

resolve mac.local failed: dial tcp: lookup mac.local on 10.22.12.45:53: no such host

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions