2

WSL 与 Windows 的交互

 2 years ago
source link: https://peon.top/show/3
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.
WSL 与 Windows 的交互蜂鸟的小窝
WSL 与 Windows 的交互

    最近我想为自己的Golang项目写一个 Makefile ,但发现我的环境是搭在 Windows 上的,又不想额外安装软件,于是我想起了 WSL,刚开始它非常好用,但我发也发现了个很蛋疼的问题,在 Windows 环境下安装的 Go 居然不能直接在WSL 下跑起来,也就是说你得在WSL再装一遍Go 于是我对此展开了研究。

    一翻搜索学习后,我发现了 WSL 其实是支持与 Windows 进行交互的,只不过运行的软件名字你得写全,比如往常你的调用方式是 go run main.go  那么现在你的调用方式是 go.exe run main.go 一翻尝试之后,发现其真的可行。但在使用中,非得加上 *.exe 那的确也麻烦,也不利于写脚本。

    最后我为 go.exe 加了一个  alias ,在 ~/.bashrc 中增加了 alias go=go.exe  问题得到了圆满的解决~

    当然其它交互问题也能如法炮制....


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK