1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 12:50:19 +01:00

adhere to the go style guide

This commit is contained in:
Karan Misra 2014-03-02 01:21:52 +05:30
parent 3d08995000
commit 02defd2cc0

View File

@ -51,22 +51,25 @@ func kernelVersion() (major, minor, patch int, err error) {
return
}
func Detect() (host Host, rev int, err error) {
func Detect() (Host, int, error) {
major, minor, patch, err := kernelVersion()
if err != nil {
return
return Null, 0, err
}
if major < 3 || (major == 3 && minor < 8) {
err = fmt.Errorf("embd: linux kernel versions lower than 3.8 are not supported. you have %v.%v.%v", major, minor, patch)
return
return Null, 0, err
}
node, err := nodeName()
if err != nil {
return
return Null, 0, err
}
var host Host
var rev int
switch node {
case "raspberrypi":
host = RPi
@ -74,7 +77,8 @@ func Detect() (host Host, rev int, err error) {
host = BBB
default:
err = fmt.Errorf("embd: your host %q is not supported at this moment. please request support at https://github.com/kidoman/embd/issues", node)
return Null, 0, err
}
return
return host, rev, nil
}