cmd/compile: dead code-elimination should work for sync.OnceValue #62202
Labels
binary-size
compiler/runtime
Issues related to the Go compiler and/or runtime.
FeatureRequest
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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:
should not link in logic for
initializeVariable
since the variable is dead.This also applies to
OnceFunc
andOnceValues
.At present,
OnceValue
is unfortunately not a drop-in replacement for forsync.Once
for initializing global variables.The text was updated successfully, but these errors were encountered: