Skip to content

Commit

Permalink
golangci-lint: run linter on code
Browse files Browse the repository at this point in the history
  • Loading branch information
pilebones committed Feb 17, 2022
1 parent 6da3bab commit 76bd352
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crawler/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func getEventFromUEventFile(path string) (rv map[string]string, err error) {
return nil, err
}

rv = make(map[string]string, 0)
rv = make(map[string]string)
buf := bufio.NewScanner(bytes.NewBuffer(data))

var line string
Expand Down
2 changes: 1 addition & 1 deletion netlink/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (r RuleDefinition) EvaluateEnv(e map[string]string) bool {
// Compile prepare rule definition to be able to Evaluate() an UEvent
func (r *RuleDefinition) Compile() error {
r.rule = &rule{
Env: make(map[string]*regexp.Regexp, 0),
Env: make(map[string]*regexp.Regexp),
}

if r.Action != nil {
Expand Down
2 changes: 1 addition & 1 deletion netlink/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestRules(testing *testing.T) {

{
Action: &add,
Env: make(map[string]string, 0),
Env: make(map[string]string),
},

{
Expand Down
6 changes: 3 additions & 3 deletions netlink/uevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func parseUdevEvent(raw []byte) (e *UEvent, err error) {
return
}

envdata := make(map[string]string, 0)
envdata := make(map[string]string)
for _, envs := range fields[0 : len(fields)-1] {
env := bytes.Split(envs, []byte("="))
if len(env) != 2 {
Expand Down Expand Up @@ -140,7 +140,7 @@ func parseUdevEvent(raw []byte) (e *UEvent, err error) {
}

func ParseUEvent(raw []byte) (e *UEvent, err error) {
if len(raw) > 40 && bytes.Compare(raw[:8], []byte("libudev\x00")) == 0 {
if len(raw) > 40 && bytes.Equal(raw[:8], []byte("libudev\x00")) {
return parseUdevEvent(raw)
}
fields := bytes.Split(raw, []byte{0x00}) // 0x00 = end of string
Expand All @@ -164,7 +164,7 @@ func ParseUEvent(raw []byte) (e *UEvent, err error) {
e = &UEvent{
Action: action,
KObj: string(headers[1]),
Env: make(map[string]string, 0),
Env: make(map[string]string),
}

for _, envs := range fields[1 : len(fields)-1] {
Expand Down

0 comments on commit 76bd352

Please sign in to comment.