-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.binary-sizecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
This is special case of #14840, but identified as a potential source of special-cases if the general case is hard to solve.
Compiling the following program:
package main
import "sync"
var initializeVariable = sync.OnceValue(func() string {
return "THIS_IS_DEAD_CODE"
})
func main() {}
should not link in logic for initializeVariable
since the variable is dead.
This also applies to OnceFunc
and OnceValues
.
At present, OnceValue
is unfortunately not a drop-in replacement for for sync.Once
for initializing global variables.
bronze1man and tmthrgd
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.binary-sizecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Todo