github.com/cilium/cilium@v1.16.2/tools/dev-doctor/unamecheck.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package main 5 6 import ( 7 "bytes" 8 "os/exec" 9 "regexp" 10 ) 11 12 var linuxRegexp = regexp.MustCompile(`(?i)linux`) 13 14 // A unameCheck checks the output of uname -a. 15 type unameCheck struct{} 16 17 func (unameCheck) Name() string { 18 return "uname" 19 } 20 21 func (unameCheck) Run() (checkResult, string) { 22 output, err := exec.Command("uname", "-a").CombinedOutput() 23 if err != nil { 24 return checkFailed, err.Error() 25 } 26 27 message := string(bytes.TrimSpace(output)) 28 if !linuxRegexp.Match(output) { 29 return checkWarning, message 30 } 31 32 return checkOK, message 33 } 34 35 func (unameCheck) Hint() string { 36 return "" 37 }