49

某些场景下 wsl2 的文件系统简直蛋疼的不行

 2 years ago
source link: https://www.v2ex.com/t/793055
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

某些场景下 wsl2 的文件系统简直蛋疼的不行

  iyaozhen · iyaozhen · 2 小时 58 分钟前 · 280 次点击

一般来说我们还是希望 IDE 运行在 windows,但是引用环境在 linux 。所以使用 wsl2 有个绕不过的问题,把文件放 windows 还是 linux 里

放 windows 里(/mnt/c ),先不论跨文件系统的性能,npm build 能卡个好几分钟不说,最主要是失去了文件监控的功能,修改文件后,不会自动化重新编译,极大影响了效率

放 linux 里(\wsl$),npm build的问题倒是没了,但是又有个 go: RLock \wsl$\Ubuntu\……\go.mod: Incorrect function. 的问题。

goland 还不支持直接使用 wsl 里面的 go 环境,所以还需要在 windows 上安装 go 环境,访问 wsl 中的文件,wsl2 本质上还是个虚拟机,windows 访问 linux 是通过网络文件系统( 9P ),然而 go 加锁不支持 9P,所以无法在 windows 上编译、运行了,IDE 上的很多功能用不了,需要进 wsl 命令行操作。

不过好在可以配置 Build on remote target,也勉强能用,但是整体操作上还是很割裂。

还有一个就是文件放 linux,万一不小心把环境删了,代码啥的都没了。

注:Mac 有,只是有时候用下 windows

相关资料:

https://docs.microsoft.com/zh-cn/windows/wsl/compare-versions

https://github.com/microsoft/WSL/issues/6255

https://www.jetbrains.com/help/go/how-to-use-wsl-development-environment-in-product.html#local_project

https://stackoverflow.com/questions/62837419/how-can-i-set-up-goroot-in-wsl2-goland

https://youtrack.jetbrains.com/issue/GO-10618

https://github.com/golang/go/issues/37461


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK