Skip to content

Commit 42c7cca

Browse files
author
Oluwole Fadeyi
authored
Merge pull request #264 from alrs/agent-errs
pkg/agent: fix dropped errors
2 parents 7986973 + 160b39a commit 42c7cca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/agent/run.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ func getConfiguration() (Config, client.Client) {
159159
defer file.Close()
160160

161161
b, err := ioutil.ReadAll(file)
162+
if err != nil {
163+
log.Fatalf("Failed to read config file: %s", err)
164+
}
162165

163166
config, err := ParseConfig(b)
164167
if err != nil {
@@ -195,7 +198,9 @@ func getConfiguration() (Config, client.Client) {
195198
defer file.Close()
196199

197200
b, err = ioutil.ReadAll(file)
198-
201+
if err != nil {
202+
log.Fatalf("Failed to read credentials file: %v", err)
203+
}
199204
credentials, err = client.ParseCredentials(b)
200205
if err != nil {
201206
log.Fatalf("Failed to parse credentials file: %s", err)
@@ -254,6 +259,9 @@ func gatherAndOutputData(config Config, preflightClient client.Client, dataGathe
254259

255260
if OutputPath != "" {
256261
data, err := json.MarshalIndent(readings, "", " ")
262+
if err != nil {
263+
log.Fatal("failed to marshal JSON")
264+
}
257265
err = ioutil.WriteFile(OutputPath, data, 0644)
258266
if err != nil {
259267
log.Fatalf("failed to output to local file: %s", err)

0 commit comments

Comments
 (0)