@@ -44,11 +44,11 @@ func PreprocessSketchWithCtags(
4444 sketch * sketch.Sketch , buildPath * paths.Path , includes paths.PathList ,
4545 lineOffset int , buildProperties * properties.Map ,
4646 onlyUpdateCompilationDatabase , verbose bool ,
47- ) (Result , error ) {
47+ ) (* Result , error ) {
4848 // Create a temporary working directory
4949 tmpDir , err := paths .MkTempDir ("" , "" )
5050 if err != nil {
51- return Result {} , err
51+ return nil , err
5252 }
5353 defer tmpDir .RemoveAll ()
5454 ctagsTarget := tmpDir .Join ("sketch_merged.cpp" )
@@ -62,25 +62,25 @@ func PreprocessSketchWithCtags(
6262 stderr .Write (result .Stderr ())
6363 if err != nil {
6464 if ! onlyUpdateCompilationDatabase {
65- return Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
65+ return & Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
6666 }
6767
6868 // Do not bail out if we are generating the compile commands database
6969 stderr .WriteString (fmt .Sprintf ("%s: %s" ,
7070 tr ("An error occurred adding prototypes" ),
7171 tr ("the compilation database may be incomplete or inaccurate" )))
7272 if err := sourceFile .CopyTo (ctagsTarget ); err != nil {
73- return Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
73+ return & Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
7474 }
7575 }
7676
7777 if src , err := ctagsTarget .ReadFile (); err == nil {
7878 filteredSource := filterSketchSource (sketch , bytes .NewReader (src ), false )
7979 if err := ctagsTarget .WriteFile ([]byte (filteredSource )); err != nil {
80- return Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
80+ return & Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
8181 }
8282 } else {
83- return Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
83+ return & Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
8484 }
8585
8686 // Run CTags on gcc-preprocessed source
@@ -89,7 +89,7 @@ func PreprocessSketchWithCtags(
8989 stderr .Write (ctagsStdErr )
9090 }
9191 if err != nil {
92- return Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
92+ return & Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
9393 }
9494
9595 // Parse CTags output
@@ -104,13 +104,13 @@ func PreprocessSketchWithCtags(
104104 if sourceData , err := sourceFile .ReadFile (); err == nil {
105105 source = string (sourceData )
106106 } else {
107- return Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
107+ return & Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
108108 }
109109 source = strings .ReplaceAll (source , "\r \n " , "\n " )
110110 source = strings .ReplaceAll (source , "\r " , "\n " )
111111 sourceRows := strings .Split (source , "\n " )
112112 if isFirstFunctionOutsideOfSource (firstFunctionLine , sourceRows ) {
113- return Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, nil
113+ return & Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, nil
114114 }
115115
116116 insertionLine := firstFunctionLine + lineOffset - 1
@@ -136,7 +136,7 @@ func PreprocessSketchWithCtags(
136136
137137 // Write back arduino-preprocess output to the sourceFile
138138 err = sourceFile .WriteFile ([]byte (preprocessedSource ))
139- return Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
139+ return & Result {args : result .Args (), stdout : stdout .Bytes (), stderr : stderr .Bytes ()}, err
140140}
141141
142142func composePrototypeSection (line int , prototypes []* ctags.Prototype ) string {
0 commit comments