Problem with Symbolic link in Go 1.23 (Is this a bug or feature?)

Hi friends, I am developing plugins for SiYuan, a notion-like note taking software based on Golang. I’ve recently encountered a problem regarding Symlink with Go.

Background: I’ve been maintaining a template repo which use Node.js​ to create symbolic link (right here: make_dev_link.js#L183) between a dist​ directory and SiYuan’s plugin directory. Once SiYuan detects a symbolic link under its plugin directory, it will load the correspondence plugin.

Problem: Recently, we found that the SiYuan no longer detects plugin under a symbolic link, and it seems that the problem might be caused by the change in return value of dir.Type()​ (please refer to SiYuan#12399), from Go 1.22 to Go 1.23.

The issue is written in Chinese, and here is the translation:


I switched to go1.22.6 for debugging and found that the issue seems to be with this judgment in go1.23.0:

func IsSymlink(dir fs.DirEntry) bool {
	return dir.Type() == fs.ModeSymlink
}

In 1.23.0, even though it is a symbolic link, it will return ModeIrregular​, which is quite frustrating.

Currently, there doesn’t seem to be any other solution. We’ll probably have to wait for a new Go release to see if it gets fixed.

It is found that dir.Type​ will return a ModeIrregular​ if dir​ is a junction link in Go 1.23.0, while it used to return ModeSymlink​ in Go 1.22 (As described in issue).

Here’s the translation:


After further testing on Windows 11:

  • Symbolic links created using mklink /D​ are recognized as ModeSymlink​ in go1.23.0.
  • Junctions created using mklink /J​ are recognized as ModeIrregular​ in go1.23.0.
  • In go1.22, both types are recognized as ModeSymlink​.

Please check if the issue is with junctions created using /J​. If so, switching to /D​ should resolve the problem.

Question: I’m not familiar with Golang. Could anyone tell me if this change is a bug or an intentional feature change? If it is a bug, I should post an issue to get it fixed.

:cry: Creating dir​ sym-link under Windows system using nodejs requires admin mode, so I prefer junction link if it’s possible.

That sounds like it might be a bug in Go.

I’d try bisecting Go to see if you can find the commit that caused the problem and report an issue.