mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Improve GoReportCard metrics, both gofmt and golint (#90)
* Format main,fake,network go source to improve GoReportCard Order of import changed in main.go and network.go, missing ending newline added in fake.go * Fixed simple golint suggestions in multiple files Mostly about missing or incomplete comments
This commit is contained in:
parent
b999a1a6f4
commit
15559903a0
6 changed files with 12 additions and 4 deletions
|
@ -21,6 +21,7 @@ import "github.com/klauspost/cpuid"
|
|||
// Source implements FeatureSource.
|
||||
type Source struct{}
|
||||
|
||||
// Name returns an identifier string for this feature source.
|
||||
func (s Source) Name() string { return "cpuid" }
|
||||
|
||||
// Discover returns feature names for all the supported CPU features.
|
||||
|
|
|
@ -19,8 +19,10 @@ package fake
|
|||
// Source implements FeatureSource.
|
||||
type Source struct{}
|
||||
|
||||
// Name returns an identifier string for this feature source.
|
||||
func (s Source) Name() string { return "fake" }
|
||||
|
||||
// Discover returns feature names for some fake features.
|
||||
func (s Source) Discover() ([]string, error) {
|
||||
features := []string{}
|
||||
|
||||
|
@ -28,4 +30,4 @@ func (s Source) Discover() ([]string, error) {
|
|||
features = append(features, "fakefeature1", "fakefeature2", "fakefeature3")
|
||||
|
||||
return features, nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,19 +19,20 @@ package network
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/golang/glog"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// Source implements FeatureSource.
|
||||
type Source struct{}
|
||||
|
||||
// Name returns an identifier string for this feature source.
|
||||
func (s Source) Name() string { return "network" }
|
||||
|
||||
// returns feature names sriov-configured and sriov if SR-IOV capable NICs are present and/or SR-IOV virtual functions are configured on the node
|
||||
// Discover returns feature names sriov-configured and sriov if SR-IOV capable NICs are present and/or SR-IOV virtual functions are configured on the node
|
||||
func (s Source) Discover() ([]string, error) {
|
||||
features := []string{}
|
||||
netInterfaces, err := net.Interfaces()
|
||||
|
|
|
@ -19,8 +19,10 @@ package panic_fake
|
|||
// Source implements FeatureSource.
|
||||
type Source struct{}
|
||||
|
||||
// Name returns an identifier string for this feature source.
|
||||
func (s Source) Name() string { return "panic_fake" }
|
||||
|
||||
// Discover calls panic().
|
||||
func (s Source) Discover() ([]string, error) {
|
||||
panic("fake panic error")
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
// Source implements FeatureSource.
|
||||
type Source struct{}
|
||||
|
||||
// Name returns an identifier string for this feature source.
|
||||
func (s Source) Name() string { return "pstate" }
|
||||
|
||||
// Discover returns feature names for p-state related features such as turbo boost.
|
||||
|
|
|
@ -31,9 +31,10 @@ const (
|
|||
// Source implements FeatureSource.
|
||||
type Source struct{}
|
||||
|
||||
// Name returns an identifier string for this feature source.
|
||||
func (s Source) Name() string { return "rdt" }
|
||||
|
||||
// Returns feature names for CMT and CAT if suppported.
|
||||
// Discover returns feature names for CMT and CAT if suppported.
|
||||
func (s Source) Discover() ([]string, error) {
|
||||
features := []string{}
|
||||
|
||||
|
|
Loading…
Reference in a new issue