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

proposal: cmd/go: Is it possible to support replace the standard library in go module? #66780

win5do opened this issue Apr 11, 2024 · 1 comment


Copy link

win5do commented Apr 11, 2024

Proposal Details


replace database/sql => ./internal/src/database/sql

Doing this now will not cause an error, but it will have no effect.

go version go1.22.0 darwin/arm64


The reason for doing this is to insert some code into the std pkg for debugging.

A practical case, I found goroutines leak through /pprof/goroutine?debug=1 and /pprof/goroutine?debug=2.

10 @ 0x104b7a7a8 0x104b44004 0x104b43bc4 0x1054075e8 0x104bb5094
#        0x1054075e7        database/sql.(*Tx).awaitDone+0x37        /opt/homebrew/opt/go/libexec/src/database/sql/sql.go:2202
goroutine 638612 [chan receive]:
        /opt/homebrew/opt/go/libexec/src/database/sql/sql.go:2202 +0x38
created by database/sql.(*DB).beginDC in goroutine 638919
        /opt/homebrew/opt/go/libexec/src/database/sql/sql.go:1915 +0x1ac

It is very difficult to find where the transaction is not released in the massive business code, so I want to insert some code in src/database/sql to track the parent caller stack.

Will Go provide similar capabilities?

@gopherbot gopherbot added this to the Proposal milestone Apr 11, 2024
Copy link

Duplicate of #35283

@seankhliao seankhliao marked this as a duplicate of #35283 Apr 11, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants