Skip to content

Commit 820de5d

Browse files
committed
Remove fatal/panic exits from diagnostic code
1 parent 9fc119c commit 820de5d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

go/extractor/diagnostics/diagnostics.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func emitDiagnostic(sourceid, sourcename, markdownMessage string, severity diagn
9898

9999
targetFile, err := os.CreateTemp(diagnosticDir, "go-extractor.*.json")
100100
if err != nil {
101-
log.Println("Failed to create temporary file for diagnostic: ")
101+
log.Println("Failed to create diagnostic file: ")
102102
log.Println(err)
103103
}
104104
defer func() {
@@ -110,7 +110,8 @@ func emitDiagnostic(sourceid, sourcename, markdownMessage string, severity diagn
110110

111111
_, err = targetFile.Write(content)
112112
if err != nil {
113-
log.Fatal(err)
113+
log.Println("Failed to write to diagnostic file: ")
114+
log.Println(err)
114115
}
115116
}
116117
}

go/extractor/extractor.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,8 @@ func ExtractWithFlags(buildFlags []string, patterns []string) error {
101101

102102
wd, err := os.Getwd()
103103
if err != nil {
104-
log.Fatalf("Unable to determine current directory: %s\n", err.Error())
105-
}
106-
107-
if util.FindGoFiles(wd) {
104+
log.Printf("Warning: failed to get working directory: %s\n", err.Error())
105+
} else if util.FindGoFiles(wd) {
108106
diagnostics.EmitGoFilesFoundButNotProcessed()
109107
}
110108
}

0 commit comments

Comments
 (0)