所有可能的GOOS值? [英] All possible GOOS value?

查看:139
本文介绍了所有可能的GOOS值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我理解正确,编译源代码时会确定 GOOS



为了更好地支持多个OS,我对 GOOS 可能是有兴趣的。



当然,它可能有无限的可能性,因为Go是开源的。所以我真正想要的是一个通用名单。



已知值包括:
$ b $ ul

  • windows

  • linux
  • darwin freebsd unix ?我知道它们中至少有一个必须存在。


  • 解决方案

    src / go / build / syslist.go

    随着Go 1.5(2015年第3季度), GOARCH 将变为很多更完整。

    通过提交1eebb91 =https://github.com/minux> Minux Ma( minux


    go / build :reserve GOARCH 架构



    每当我们引入一个新的 GOARCH 时,较旧的Go版本将无法识别它们,这会给两者带来麻烦我们的用户和我们(我们需要添加不必要的构建标签)。

    Go 1.5已经推出了三个新的GOARCHes: arm64 ppc64 ppc64le ,我们可以花时间为将来可能支持的所有常见架构引入GOARCHes,以避免此问题。




      const goosList =android darwin dragonfly freebsd linux nacl \ 
    netbsd openbsd plan9 solaris windows
    $ b const goarchList =386 amd64 amd64p32 arm arm64 ppc64 ppc64le \
    mips mipsle mips64 mips64le mips64p32 mips64p32le \#(new)
    ppc s390 s390x sparc sparc64#(new)

    该清单仍在更改9644 中进行审核, :


    我不打扰安腾。它基本上是一个死架构。

    另外,为它编写编译器非常困难,除非作为爱的劳动,没有人喜欢Itanium,否则我真的无法看到它发生。


    官方文档 现在(GO 1.5+ 2015年第三季度)反映了已完成的列表。


    If I get it right, GOOS is determined when compile the source code.

    To better support multiple OS, I'm interested in what GOOS could be.

    Of course, there might be infinite possibilities of it, since Go is opensourced. So what I really want is a "common list".

    Known values are:

    • windows
    • linux
    • darwin or freebsd or unix? I know that at least one of them must exist.

    解决方案

    Note that those values are defined in src/go/build/syslist.go.

    With Go 1.5 (Q3 2015), GOARCH will become much more complete.
    See commit 1eebb91 by Minux Ma (minux)

    go/build: reserve GOARCH values for all common architectures

    Whenever we introduce a new GOARCH, older Go releases won't recognize them and this causes trouble for both our users and us (we need to add unnecessary build tags).

    Go 1.5 has introduced three new GOARCHes so far: arm64 ppc64 ppc64le, we can take the time to introduce GOARCHes for all common architectures that Go might support in the future to avoid the problem.

    const goosList = "android darwin dragonfly freebsd linux nacl \ 
      netbsd openbsd plan9 solaris windows "
    
    const goarchList = "386 amd64 amd64p32 arm arm64 ppc64 ppc64le \
       mips mipsle mips64 mips64le mips64p32 mips64p32le \ # (new)
       ppc s390 s390x sparc sparc64 " # (new)
    

    The list is still being review in Change 9644, with comments like:

    I wouldn't bother with Itanium. It's basically a dead architecture.
    Plus, it's so hard to write a compiler for it that I really can't see it happening except as a labor of love, and nobody loves the Itanium.

    The official documentation now (GO 1.5+ Q3 2015) reflects that completed list.

    这篇关于所有可能的GOOS值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆