How to detect if a 32-bit or 64-bit architecture in Go

1 Answer

0 votes
package main

import (
	"fmt"
	"strconv"
)

func main() {
	if strconv.IntSize == 32 {
		fmt.Println("32-bit")
	}
	if strconv.IntSize == 64 {
	    fmt.Println("64-bit")
	}
}



/*
run:

64-bit

*/

 



answered Jun 20, 2025 by avibootz

Related questions

...