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

CGO_ENABLED=0 dial tcp: lookup on no such host #40686

kotyara85 opened this issue Aug 11, 2020 · 3 comments


Copy link

@kotyara85 kotyara85 commented Aug 11, 2020

This error happens when the binary compiled with CGO_ENABLED=0 for darwin platform.
Possibly the same issue with linux & windows.

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

go version go1.13.10 darwin/amd64

Does this issue reproduce with the latest release?


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

go env Output
$ go env

What did you do?

CGO_ENABLED=0 go run main.go

What did you expect to see?

No error

What did you see instead?

FATA[2020-08-11T00:13:51-07:00] Get dial tcp: lookup on no such host

Copy link

@davecheney davecheney commented Aug 11, 2020

The DNS server at told your program that it did not have a record for

Why do you think this is a problem with Go?

Copy link

@kotyara85 kotyara85 commented Aug 11, 2020

I changed a real hostname for security reasons.
If I compile with CGO_ENABLED=1 it works just fine, so yes it’s a go issue.

Copy link

@rsc rsc commented Aug 11, 2020

I can't reproduce this problem using this program:

package main

import (

func main() {
	_, err := net.Dial("tcp", "")
	if err != nil {

It succeeds with and without CGO_ENABLED=0. Do other host names resolve? Is the problem specific to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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