Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
Go playground using GOOS=nacl
What did you do?
I was actually testing for race conditions (both Link and Rename are missing calls to lock
the filesystem for which I will create a separate issue), but there's actually no need to
run concurrent goroutines here. Simply attempting to Link(a, b) twice will corrupt the
internal filesystem by leaving two files but a link count of three.
Test added first and verified that it fails.
Fix added to fs_nacl.go. It's not tied to GOOS since it's a valid test regardless (though unlikely to fail on any other platform). The test is a modified copy of part of the existing rename tests.
Verified that the test passes both for the NaCl build and for linux x64.