Home>Article>Backend Development> Compile go project into linux executable file under windows10

Compile go project into linux executable file under windows10

藏色散人
藏色散人 forward
2020-09-04 13:48:00 3527browse

The following column will introduce to you how to compile go projects into Linux executable files under Windows 10 from thegolang tutorialcolumn. I hope it will be helpful to friends in need!

Compile go project into linux executable file under windows10

I compiled an exe executable file in advance, no problem
Set the linux compilation configuration:

SET GOOS=linux SET GOARCH=amd64 SET CGO_ENABLED=0

Then compile again and it prompts that I can’t find it. logfmt package:

windows10 编译go项目为linux可执行文件
Global search for this package:
Found that only go.sum memory contains the package information

windows10 编译go项目为linux可执行文件

Attach me The mod:

windows10 编译go项目为linux可执行文件

I'm not sure if there's a package that depends on it that's causing my problem, but I was able to compile it before and couldn't compile after reconfiguring it
Now when I set: SET GOOS=windows, it is invalid. It cannot be compiled.
prompts that the package path cannot be found, and after I go get it, it has no effect.

The above is the detailed content of Compile go project into linux executable file under windows10. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete