Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use runtime to get os info #332

Merged
merged 1 commit into from
Mar 10, 2017
Merged

use runtime to get os info #332

merged 1 commit into from
Mar 10, 2017

Conversation

tinylcy
Copy link
Contributor

@tinylcy tinylcy commented Mar 10, 2017

通过 os.Getenv("GOOS") 无法获取到os的信息。

@unknwon
Copy link
Owner

unknwon commented Mar 10, 2017

截图看下你执行命令 go env 的输出

@tinylcy
Copy link
Contributor Author

tinylcy commented Mar 10, 2017

下图是执行命令 go env 的输出:
goos

下图是原代码及输出:
goos_os

@unknwon
Copy link
Owner

unknwon commented Mar 10, 2017

别用内置的 用系统终端执行看看

@tinylcy
Copy link
Contributor Author

tinylcy commented Mar 10, 2017

我在cmd下执行 go env 的输出:

cmd

@unknwon
Copy link
Owner

unknwon commented Mar 10, 2017

程序在终端的输出呢?

@tinylcy
Copy link
Contributor Author

tinylcy commented Mar 10, 2017

程序在终端的输出:
cmd

@unknwon
Copy link
Owner

unknwon commented Mar 10, 2017

额,好吧,新版 Go 已经没必要设置这变量了。

我觉得加个备注说明下最新的 Go 版本已经比较智能,不需要显式设置此类变量了。

如果按照现在说改的内容,与上下文不符。

@unknwon
Copy link
Owner

unknwon commented Mar 10, 2017

好像也可以。。runtime 应该是编译的时候决定的,但是你不编译 windows 的就不能跑在 windows 上。

@unknwon unknwon merged commit 865cbc3 into unknwon:master Mar 10, 2017
@tinylcy tinylcy deleted the tinylcy-pr branch December 15, 2017 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants