github.com/gojue/ecapture@v0.8.2/main.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/gojue/ecapture/cli"
     5  	"github.com/gojue/ecapture/pkg/util/kernel"
     6  	_ "github.com/shuLhan/go-bindata" // add for bindata in Makefile
     7  	"log"
     8  	"runtime"
     9  )
    10  
    11  func main() {
    12  
    13  	// 环境检测
    14  	// 系统内核版本检测
    15  	kv, err := kernel.HostVersion()
    16  	if err != nil {
    17  		log.Fatal(err)
    18  	}
    19  	switch runtime.GOARCH {
    20  	case "amd64":
    21  		if kv < kernel.VersionCode(4, 18, 0) {
    22  			log.Fatalf("The Linux/Android Kernel version %v (x86_64) is not supported. Requires a version greater than 4.18.", kv)
    23  		}
    24  	case "arm64":
    25  		if kv < kernel.VersionCode(5, 5, 0) {
    26  			log.Fatalf("The Linux/Android Kernel version %v (aarch64) is not supported. Requires a version greater than 5.5.", kv)
    27  		}
    28  	default:
    29  		log.Fatalf("Unsupported CPU arch:%v. ", runtime.GOARCH)
    30  	}
    31  
    32  	cli.Start()
    33  }