Skip to content

Commit 38643a5

Browse files
committed
Always write a correct compilation database
Even if the Contents field is empty.
1 parent b7f8a6e commit 38643a5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

arduino/builder/compilation_database.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ type CompilationCommand struct {
4141
// NewCompilationDatabase creates an empty CompilationDatabase
4242
func NewCompilationDatabase(filename *paths.Path) *CompilationDatabase {
4343
return &CompilationDatabase{
44-
File: filename,
44+
File: filename,
45+
Contents: []CompilationCommand{},
4546
}
4647
}
4748

@@ -51,10 +52,7 @@ func LoadCompilationDatabase(file *paths.Path) (*CompilationDatabase, error) {
5152
if err != nil {
5253
return nil, err
5354
}
54-
res := &CompilationDatabase{
55-
File: file,
56-
Contents: []CompilationCommand{},
57-
}
55+
res := NewCompilationDatabase(file)
5856
return res, json.Unmarshal(f, &res.Contents)
5957
}
6058

0 commit comments

Comments
 (0)