@@ -17,10 +17,10 @@ package sketch
17
17
18
18
import (
19
19
"context"
20
- "os"
20
+ "io/ioutil"
21
+ "os"
21
22
"path/filepath"
22
23
"strings"
23
- "io/ioutil"
24
24
25
25
"github.com/arduino/arduino-cli/commands"
26
26
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
@@ -36,11 +36,11 @@ void loop() {
36
36
37
37
// CreateSketch creates a new sketch
38
38
func CreateSketch (sketchName string ) (string , string , error ) {
39
- // Trim to avoid issues if user creates a sketch adding the .ino extesion to the name
39
+ // Trim to avoid issues if user creates a sketch adding the .ino extesion to the name
40
40
trimmedSketchName := strings .TrimSuffix (sketchName , ".ino" )
41
41
sketchDir , err := filepath .Abs (trimmedSketchName )
42
42
if err != nil {
43
- return "" , "" , err
43
+ return "" , "" , err
44
44
}
45
45
if err := os .MkdirAll (sketchDir , os .FileMode (0755 )); err != nil {
46
46
return "" , "" , err
@@ -50,15 +50,15 @@ func CreateSketch(sketchName string) (string, string, error) {
50
50
if err := ioutil .WriteFile (sketchFile , emptySketch , os .FileMode (0644 )); err != nil {
51
51
return "" , "" , err
52
52
}
53
- return sketchDir , sketchFile , nil
53
+ return sketchDir , sketchFile , nil
54
54
}
55
55
56
56
// NewSketch FIXMEDOC
57
57
func NewSketch (ctx context.Context , req * rpc.NewSketchRequest ) (* rpc.NewSketchResponse , error ) {
58
- _ , sketchFile , err := CreateSketch (req .SketchName );
59
- if err != nil {
60
- return nil , & commands.CantCreateSketchError {Cause : err }
61
- }
58
+ _ , sketchFile , err := CreateSketch (req .SketchName )
59
+ if err != nil {
60
+ return nil , & commands.CantCreateSketchError {Cause : err }
61
+ }
62
62
63
63
return & rpc.NewSketchResponse {MainFile : sketchFile }, nil
64
64
}
0 commit comments