Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
primitives
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xx network
primitives
Commits
d44df746
Commit
d44df746
authored
Sep 10, 2021
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Remove error return from LogHardware
parent
057d4e97
No related branches found
No related tags found
2 merge requests
!9
Release
,
!4
prototype hardware logging
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
hw/getHw.go
+6
-7
6 additions, 7 deletions
hw/getHw.go
hw/getHw_test.go
+1
-4
1 addition, 4 deletions
hw/getHw_test.go
with
7 additions
and
11 deletions
hw/getHw.go
+
6
−
7
View file @
d44df746
...
...
@@ -9,7 +9,6 @@
package
hw
import
(
"errors"
"fmt"
jww
"github.com/spf13/jwalterweatherman"
"os/exec"
...
...
@@ -53,7 +52,7 @@ var commandMap = map[string][]string{
// LogHardware iterates over commandList, running the command
// from the commandMap and printing out the results.
func
LogHardware
()
error
{
func
LogHardware
()
{
jww
.
INFO
.
Printf
(
header
,
begin
)
for
_
,
cmdHeader
:=
range
commandList
{
...
...
@@ -66,13 +65,13 @@ func LogHardware() error {
cmd
:=
strings
.
Join
(
cmdList
,
" "
)
if
len
(
cmdList
)
==
1
{
// Handle quirks of exec.Command() and variable command length
out
,
err
=
exec
.
Command
(
cmdList
[
0
])
.
Output
()
if
err
!=
nil
{
return
errors
.
New
(
fmt
.
Sprintf
(
"%s err: %s"
,
cmdList
,
err
))
if
err
!=
nil
{
// Print error, continue with other commands
out
=
[]
byte
(
(
fmt
.
Sprintf
(
"%s err: %s"
,
cmdList
,
err
))
)
}
}
else
{
out
,
err
=
exec
.
Command
(
cmdList
[
0
],
cmdList
[
1
:
]
...
)
.
Output
()
if
err
!=
nil
{
return
errors
.
New
(
fmt
.
Sprintf
(
"%s err: %s"
,
cmdList
,
err
))
if
err
!=
nil
{
// Print error, continue with other commands
out
=
[]
byte
(
(
fmt
.
Sprintf
(
"%s err: %s"
,
cmdList
,
err
))
)
}
}
...
...
@@ -82,5 +81,5 @@ func LogHardware() error {
jww
.
INFO
.
Printf
(
header
,
end
)
return
nil
return
}
This diff is collapsed.
Click to expand it.
hw/getHw_test.go
+
1
−
4
View file @
d44df746
...
...
@@ -9,8 +9,5 @@ package hw
import
"testing"
func
TestLogHardware
(
t
*
testing
.
T
)
{
err
:=
LogHardware
()
if
err
!=
nil
{
t
.
Fatalf
(
"Function errored: %s"
,
err
)
}
LogHardware
()
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment