Skip to content

os: winsymlink and winreadlinkvolume missing IncNonDefault calls #66215

@rsc

Description

@rsc

The new definitions of winsymlink and winreadlinkvolume godebugs in package os are missing calls to IncNonDefault to record when they change the behavior of the program. See go doc internal/godebug for details.

Note that to be a useful metric, IncNonDefault has to be called only when the result is actually different, not just when new code is executing that does the same thing old code would have done for a given input. That means checking the input and understanding when a deviation is happening.

This means that

if winsymlink.Value() == "0" {
	return fs.modePreGo1_23()
}

is not a viable implementation strategy on its own. However, one possibility is to rename the current Mode to mode and then do

func (fs *fileStat) Mode() FileMode {
	m := fs.mode()
	if winsymlink.Value() == "0" {
		old := fs.modePreGo1_23()
		if old != m {
			winsymlink.IncNonDefault()
			m = old
		}
	}
	return m
}

/cc @qmuntal

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions