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

code issue src/net/http server.go 2238rows & 2240rows undefined: defaultServeMux #40945

Closed
Wzy-CC opened this issue Aug 21, 2020 · 2 comments
Closed

Comments

@Wzy-CC
Copy link

@Wzy-CC Wzy-CC commented Aug 21, 2020

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

$ go version go1.14.2 windows/amd64

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

go env Output
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\W10\AppData\Local\go-build
set GOENV=C:\Users\W10\AppData\Roaming\go\env  
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\W10\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\W10\AppData\Local\Temp\go-build117313770=/tmp/go-build -gno-record-gcc-switches

What did you do?

Learning net/http server.go find 2238 row

// DefaultServeMux is the default ServeMux used by Serve.
var DefaultServeMux = &defaultServeMux

var defaultServeMux ServeMux

use the defaultServeMux before defined ?

What did you expect to see?

// DefaultServeMux is the default ServeMux used by Serve.
var defaultServeMux ServeMux

var DefaultServeMux = &defaultServeMux

What did you see instead?

@davecheney
Copy link
Contributor

@davecheney davecheney commented Aug 21, 2020

use the defaultServeMux before defined ?

In Go there is no reason to declare a symbol before it is used at the package level.

Thank you for raising this issue. Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For asking questions, see:

@davecheney davecheney closed this Aug 21, 2020
@Wzy-CC
Copy link
Author

@Wzy-CC Wzy-CC commented Aug 21, 2020

Thanks

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

Successfully merging a pull request may close this issue.

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