github.com/goravel/framework@v1.13.9/support/env/env.go (about)

     1  package env
     2  
     3  import "runtime"
     4  
     5  // IsWindows returns whether the current operating system is Windows.
     6  // IsWindows 返回当前操作系统是否为 Windows。
     7  func IsWindows() bool {
     8  	return runtime.GOOS == "windows"
     9  }
    10  
    11  // IsLinux returns whether the current operating system is Linux.
    12  // IsLinux 返回当前操作系统是否为 Linux。
    13  func IsLinux() bool {
    14  	return runtime.GOOS == "linux"
    15  }
    16  
    17  // IsDarwin returns whether the current operating system is Darwin.
    18  // IsDarwin 返回当前操作系统是否为 Darwin。
    19  func IsDarwin() bool {
    20  	return runtime.GOOS == "darwin"
    21  }
    22  
    23  // IsArm returns whether the current CPU architecture is ARM.
    24  // IsArm 返回当前 CPU 架构是否为 ARM。
    25  func IsArm() bool {
    26  	return runtime.GOARCH == "arm" || runtime.GOARCH == "arm64"
    27  }
    28  
    29  // IsX86 returns whether the current CPU architecture is X86.
    30  // IsX86 返回当前 CPU 架构是否为 X86。
    31  func IsX86() bool {
    32  	return runtime.GOARCH == "386" || runtime.GOARCH == "amd64"
    33  }
    34  
    35  // Is64Bit returns whether the current CPU architecture is 64-bit.
    36  // Is64Bit 返回当前 CPU 架构是否为 64 位。
    37  func Is64Bit() bool {
    38  	return runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64"
    39  }