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: inconsistent dial tcp error message, some have colon, some don't #45020

Open
digininja opened this issue Mar 15, 2021 · 1 comment
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@digininja
Copy link

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

$ go version

$ go version
go version go1.16.2 linux/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/robin/.cache/go-build"
GOENV="/home/robin/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/robin/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/robin/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go_current"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go_current/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/xxxx/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2613921442=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Making HTTP requests and trying to handle errors

    client := &http.Client{
        CheckRedirect: func(req *http.Request, via []*http.Request) error {
            return http.ErrUseLastResponse
        },  
    }   

    log.Debugf("Requesting URL: %s\n", url)
    req, err := http.NewRequest("GET", url, nil)

    resp, err := client.Do(req)

  if err != nil {
        log.Debugf("Generic error: %s", err)
}

What did you expect to see?

Consistent use of the phrase dial tcp in error messages.

What did you see instead?

Some errors from dial tcp have a colon after the tcp, some don't:

DEBU[0003] Generic error: Get "http://host1.int": dial tcp 192.168.0.1:80: connect: no route to host
DEBU[0000] Generic error: Get "http://raasdfst.krynn.int": dial tcp: lookup host2.int on 192.168.0.2:53: no such host

Spotted this because I'm trying to tidy the errors up a bit to give a user a bit more information, my regexp was looking for dial tcp: then I found the one without the colon.

I've not dug in to see how may have or don't have the colon.

Thought I'd report it as it would be nice to have consistency over whether the colon is there or not.

@cherrymui cherrymui added this to the Backlog milestone Mar 15, 2021
@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 15, 2021
@cherrymui
Copy link
Member

cc @bradfitz

@cherrymui cherrymui changed the title Inconsistent dial tcp error message, some have colon, some don't net: inconsistent dial tcp error message, some have colon, some don't Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants