Skip to content

Commit 8b8638c

Browse files
committed
Removed 'Writing compilation database...' message
Also slightly refactore code
1 parent 4247f48 commit 8b8638c

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

arduino/builder/compilation_database.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package builder
33
import (
44
"encoding/json"
55
"fmt"
6-
"github.com/arduino/go-paths-helper"
7-
"io/ioutil"
86
"os"
97
"os/exec"
8+
9+
"github.com/arduino/go-paths-helper"
1010
)
1111

1212
type compilationCommand struct {
@@ -29,16 +29,10 @@ func NewCompilationDatabase(filename *paths.Path) *CompilationDatabase {
2929
func (db *CompilationDatabase) UpdateFile(complete bool) {
3030
// TODO: Read any existing file and use its contents for any
3131
// kept files, or any files not in db.contents if !complete.
32-
fmt.Printf("Writing compilation database to \"%s\"...\n", db.filename.String())
33-
34-
contents := db.contents
35-
jsonContents, err := json.MarshalIndent(contents, "", " ")
36-
if err != nil {
32+
if jsonContents, err := json.MarshalIndent(db.contents, "", " "); err != nil {
3733
fmt.Printf("Error serializing compilation database: %s", err)
3834
return
39-
}
40-
err = ioutil.WriteFile(db.filename.String(), jsonContents, 0644)
41-
if err != nil {
35+
} else if err := db.filename.WriteFile(jsonContents); err != nil {
4236
fmt.Printf("Error writing compilation database: %s", err)
4337
}
4438
}

0 commit comments

Comments
 (0)