Commit Graph

10 Commits

Author SHA1 Message Date
Ed Bartosh
cec004c398 lint: enable wsl check
Fixes: #392

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2021-12-17 11:48:48 +02:00
Mikko Ylinen
facb4214a2 tree-wide: drop deprecated io/ioutil
Go 1.16 release notes announced the deprecation of io/ioutil [1]. It's easy
for us to move to use what is was recommended so just do it.

[1] https://golang.org/doc/go1.16#ioutil

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2021-06-02 13:41:15 +03:00
Ed Bartosh
205722e53b topology: language cleanup
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2020-12-10 11:29:58 +02:00
Dmitry Rozhkov
7ff08ee874 linter: enable staticcheck 2020-08-25 09:54:59 +03:00
Mikko Ylinen
cd068c797a ci: update tool versions
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-08-21 17:04:04 +03:00
Dmitry Rozhkov
70f862f2aa add golangci linter
In this initial commit the following checks are disabled due to
excessive amount of changes required:
- dupl (duplicate code)
- funlen (function length)
- goerr113 (errors handling expressions)
- gomnd (magic numbers)
- gosec (security)
- nakedret (naked returns)
- wsl (forces to use empty lines)
- errcheck (checking for unchecked errors)
- staticcheck (static analysis)
2020-06-08 14:01:13 +03:00
Ukri Niemimuukko
39c934b22f topology: avoid unnecessary warning prints
Doing strings.Split with a non-empty separator against a potentially
empty string (hint.NUMAs) may return an empty string in a slice of
size one, which then doesn't parse nicely with ParseInt and results
in a repeating warning.

It is better to check for hint.NUMAs emptiness before trying to
split it.

Signed-off-by: Ukri Niemimuukko <ukri.niemimuukko@intel.com>
2020-04-16 19:11:39 +03:00
Ed Bartosh
1bbcbc65da fix cyclomatic check failure
Moved part of the code from NewTopologyHints to getTopologyHint to
decrease cyclomatic complexity.

This should fix this failure:
  $ make checks
  Complexity is over 15 in
  20 topology NewTopologyHints pkg/topology/topology.go:83:1
  Makefile:23: recipe for target 'cyclomatic-check' failed
  make: *** [cyclomatic-check] Error 1
2020-02-11 14:20:44 +02:00
Ed Bartosh
366d07a35e topology: Fix lint warnings
Fixed the following golint warnings:
 $ make checks
  ./pkg/topology/topology.go:44:6: type name will be used as topology.TopologyHint by other packages, and that stutters; consider calling this Hint
  ./pkg/topology/topology.go:52:6: type name will be used as topology.TopologyHints by other packages, and that stutters; consider calling this Hints
  Found 2 lint suggestions; failing.
  Makefile:47: recipe for target 'lint' failed
2020-02-11 14:20:44 +02:00
Ed Bartosh
3f83e2b2eb Copy toplogogy module from cri-resource-manager
Copied topology module to avoid external dependency.
Added GetTopologyInfo function and its test case.
2020-02-11 12:06:25 +02:00