Skip to content

Commit

Permalink
golint: reduce ineffective assignment warnings
Browse files Browse the repository at this point in the history
o use error from ParseUint
o use modified from .Merge

Fixes the following warning

... err assigned and not used (ineffassign)
... modified assigned and not used (ineffassign)

Related-to: #153 (Resolve golint warnings)
Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
  • Loading branch information
aalemayhu authored and tgraf committed Mar 18, 2017
1 parent d71b9bd commit 251a89d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cilium/cmd/bpf_policy_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func updatePolicyKey(cmd *cobra.Command, args []string, add bool) {
}

peerLbl, err := strconv.ParseUint(args[1], 10, 32)
if err != nil {
Fatalf("Failed to convert %s", args[1])
}

if add == true {
if err := policyMap.AllowConsumer(uint32(peerLbl)); err != nil {
Fatalf("Cannot add policy key: %s", err)
Expand Down
1 change: 1 addition & 0 deletions pkg/policy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ func (s *PolicyTestSuite) TestNodeMerge(c *C) {
c.Assert(aNode.CanMerge(&unmergeableNode), Not(Equals), nil)

modified, err = aNode.Merge(&unmergeableNode)
c.Assert(modified, Equals, false)
c.Assert(err, Not(Equals), nil)
}

Expand Down

0 comments on commit 251a89d

Please sign in to comment.