Skip to content

proposal: go/doc: deprecate New #73089

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

Open
mateusz834 opened this issue Mar 28, 2025 · 3 comments
Open

proposal: go/doc: deprecate New #73089

mateusz834 opened this issue Mar 28, 2025 · 3 comments
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Milestone

Comments

@mateusz834
Copy link
Member

mateusz834 commented Mar 28, 2025

Proposal Details

In the go/doc there is a function that accepts a *ast.Package, called New. We already have an alternative that work with ordinary *ast.Files, NewFromFiles. So i think that we should deprecate it in favour of NewFromFiles.

Related: #71122, #73088, #7124

CC @adonovan @griesemer

@gopherbot gopherbot added this to the Proposal milestone Mar 28, 2025
@mateusz834
Copy link
Member Author

New docs already suggest using NewFromFiles

go/src/go/doc/doc.go

Lines 119 to 121 in 26fdb07

// To have the [Examples] fields populated, use [NewFromFiles] and include
// the package's _test.go files.
func New(pkg *ast.Package, importPath string, mode Mode) *Package {

@mateusz834
Copy link
Member Author

mateusz834 commented Mar 28, 2025

@gabyhelp
Copy link

Related Code Changes

Related Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gabyhelp gabyhelp added the LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Projects
None yet
Development

No branches or pull requests

3 participants