How to get hold of GOARM at runtime?

138 views
Skip to first unread message

jan.f...@gmail.com

unread,
Jan 19, 2021, 2:36:24 PM1/19/21
to golang-nuts
Hi,

Short question: GOARCH and GOOS is available from the runtime package, but how do I get hold of the corresponding variable GOARM at runtime?

Best Regards
    //Jan Flyborg

Ian Lance Taylor

unread,
Jan 19, 2021, 4:00:55 PM1/19/21
to jan.f...@gmail.com, golang-nuts
On Tue, Jan 19, 2021 at 11:36 AM jan.f...@gmail.com
<jan.f...@gmail.com> wrote:
>
> Short question: GOARCH and GOOS is available from the runtime package, but how do I get hold of the corresponding variable GOARM at runtime?

I don't think there is a way to fetch it directly, but you can see it
by running "go env GOARM".

Ian

Keith Randall

unread,
Jan 19, 2021, 9:31:10 PM1/19/21
to golang-nuts
You should also consider using x/sys/cpu to query the cpu features directly (not sure if that applies to your use case or not).
Reply all
Reply to author
Forward
0 new messages