Build不包含带有文件后缀的源

时间:2017-06-26 09:07:44

标签: go

在ubuntu下编译

  

Linux ip 3.13.0-48-generic#80-Ubuntu SMP Thu Mar 12 12:16:15 UTC 2015   x86_64 x86_64 x86_64 GNU / Linux

golang version

  

go go go.8.3.3 linux / amd64

我的文件:

  

daemon_darwin.go daemon_freebsd.go daemon.go daemon_linux.go   daemon_windows.go LICENSE os.go README.md

我执行的命令

GOOS=darwin GOARCH=amd64 go build -x

我得到的输出

WORK=/tmp/go-build026556308 mkdir -p
$WORK/github.com/VividCortex/godaemon/_obj/ mkdir -p
$WORK/github.com/VividCortex/ cd
/root/go/src/github.com/VividCortex/godaemon
/home/jenkinsBuilder/tools/org.jenkinsci.plugins.golang.GolangInstallation/Go_1.8/pkg/tool/linux_amd64/compile
-o $WORK/github.com/VividCortex/godaemon.a -trimpath $WORK -p github.com/VividCortex/godaemon -complete -buildid
398bd35cdb7ed0aa42a3e6ea64677925441c29cb -D
_/root/go/src/github.com/VividCortex/godaemon -I $WORK -pack ./daemon.go ./os.go
# github.com/VividCortex/godaemon ./daemon.go:167: undefined: GetExecutablePath

我们可以看到daemon_darwin.go 包含在编译命令中,尽管我已添加GOOS=darwin

如果我尝试使用GOOS=windows,它会正确构建,并且正在添加daemon_windows.go

0 个答案:

没有答案