Hacker News new | ask | show | jobs
by johnvega 1879 days ago
On my 2nd chromebook computer but likely moving back to mostly to Windows because of WSL2.

Just 1 of many benefits: build native Windows GoLang app from WSL2: (Caddy server)

env GOOS=windows go build -o caddy.exe

No need to setup gcc in native Windows. Not sure if this works on all GoLang apps, but at least works for a reasonably complex Caddy server

3 comments

I was under the impression that Go cross-compilation between architectures and operating systems wasn't a problem already...

Am I missing something? What does this have to do with WSL 2?

You can compile for windows, on windows, without the pain of setting up a compilation environment on windows.
That's awesome, although it's not as great as it might appear at first glance. I once took on a job to write a .bat script to compile a GO app any Windows machine without any Go environment installed. The script ended up about 20 lines long, and could compile the app on a fresh Windows install on any machine. It just took all day to write when I thought it would be done in 30 minutes.

Working with GO on Windows can be a pain, but my takeaway from this ordeal was that it wasn't really the fault of MS or Google, but due to most Windows users actually having no idea how Windows works, even software developers who have been using the OS for 20 years.

The NT kernel/hypervisor is a marvel of software engineering but unfortunately it is not as easy to teach in OS classes compared to Unix/Linux family systems.
Which chromebook do you have? I was recently tinkering with my pixelbook on the dev channel, I believe you can launch kvm vms from the chromeos 'linux subsystem' it's kind of like WSL2 in reverse but with KVM vs hyper-v. Wonder how a win10 vm would run, although the lack of workstation grade hardware for chromeos seems like it would hold that back. Launching android apps is pretty slick though
I have to use a secure Windows laptop for work, but I admin Linux servers. WSL has been great for me, if only so that I can use a real linux command line and terminal instead of PuTTY when I SSH into boxes.