A Big Problem in Go That No One Talks About

2 min read Original article ↗

Compiling Go projects into a Windows executable is problematic, due to a lack of communication between Google and Microsoft

Marvin Wendt

Press enter or click to view image in full size

Photo by Elisa Ventur on Unsplash

Cross-Compiling Go Projects

If you’re a Go developer, you’re probably aware that cross-compiling is one of the big features of the language. This allows you to compile your code on one platform for use on another. For example, you can compile your code on a Mac for use on a Windows machine. This is fantastic for developers who want to target multiple platforms with their code.

However, there is a big problem when compiling Go projects for use on Windows.

The Problem

When a Go project is compiled for Windows, a single binary is created (on Windows, these are .exe files). The process of how Go compiles this binary is relatively unique, and often confuses antivirus scanners, resulting in the binary being mistakenly detected as a virus.

This is of course quite problematic, as it can happen that the browser does not allow a download of the compiled file at all. That was the case in one of my open-source projects. Users were not able to download new releases. If they disabled the virus scanner in Chrome and downloaded the…