Skip to content

Commit 6f0a39d

Browse files
committed
Pass of gofmt
Signed-off-by: Cristian Maglie <[email protected]>
1 parent 432c974 commit 6f0a39d

File tree

8 files changed

+40
-37
lines changed

8 files changed

+40
-37
lines changed

src/arduino.cc/builder/builder.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@
3030
package builder
3131

3232
import (
33+
"os"
34+
"reflect"
35+
"strconv"
36+
"time"
37+
3338
"arduino.cc/builder/constants"
3439
"arduino.cc/builder/i18n"
3540
"arduino.cc/builder/phases"
3641
"arduino.cc/builder/types"
3742
"arduino.cc/builder/utils"
38-
"os"
39-
"reflect"
40-
"strconv"
41-
"time"
4243
)
4344

4445
var MAIN_FILE_VALID_EXTENSIONS = map[string]bool{".ino": true, ".pde": true}
@@ -123,7 +124,7 @@ func (s *Builder) Run(ctx *types.Context) error {
123124
mainErr := runCommands(ctx, commands, true)
124125

125126
commands = []types.Command{
126-
&PrintUsedAndNotUsedLibraries{ SketchError: mainErr != nil },
127+
&PrintUsedAndNotUsedLibraries{SketchError: mainErr != nil},
127128

128129
&PrintUsedLibrariesIfVerbose{},
129130
}

src/arduino.cc/builder/phases/sketch_builder.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ package phases
3131

3232
import (
3333
"arduino.cc/builder/builder_utils"
34+
"arduino.cc/builder/constants"
3435
"arduino.cc/builder/i18n"
3536
"arduino.cc/builder/types"
3637
"arduino.cc/builder/utils"
37-
"arduino.cc/builder/constants"
38-
"path/filepath"
3938
"os"
39+
"path/filepath"
4040
)
4141

4242
type SketchBuilder struct{}

src/arduino.cc/builder/sketch_loader.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@
3030
package builder
3131

3232
import (
33-
"arduino.cc/builder/constants"
34-
"arduino.cc/builder/i18n"
35-
"arduino.cc/builder/types"
36-
"arduino.cc/builder/utils"
3733
"io/ioutil"
3834
"os"
3935
"path/filepath"
4036
"sort"
4137
"strings"
38+
39+
"arduino.cc/builder/constants"
40+
"arduino.cc/builder/i18n"
41+
"arduino.cc/builder/types"
42+
"arduino.cc/builder/utils"
4243
)
4344

4445
type SketchLoader struct{}
@@ -91,7 +92,7 @@ func collectAllSketchFiles(from string) ([]string, error) {
9192
// Source files in the root are compiled, non-recursively. This
9293
// is the only place where .ino files can be present.
9394
rootExtensions := func(ext string) bool { return MAIN_FILE_VALID_EXTENSIONS[ext] || ADDITIONAL_FILE_VALID_EXTENSIONS[ext] }
94-
err := utils.FindFilesInFolder(&filePaths, from, rootExtensions, /* recurse */ false)
95+
err := utils.FindFilesInFolder(&filePaths, from, rootExtensions, false /* recurse */)
9596
if err != nil {
9697
return nil, i18n.WrapError(err)
9798
}
@@ -101,7 +102,7 @@ func collectAllSketchFiles(from string) ([]string, error) {
101102
srcPath := filepath.Join(from, constants.SKETCH_FOLDER_SRC)
102103
if info, err := os.Stat(srcPath); err == nil && info.IsDir() {
103104
srcExtensions := func(ext string) bool { return ADDITIONAL_FILE_VALID_EXTENSIONS[ext] }
104-
err = utils.FindFilesInFolder(&filePaths, srcPath, srcExtensions, /* recurse */ true)
105+
err = utils.FindFilesInFolder(&filePaths, srcPath, srcExtensions, true /* recurse */)
105106
}
106107
return filePaths, i18n.WrapError(err)
107108
}

src/arduino.cc/builder/test/prototypes_adder_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
8282
NoError(t, err)
8383
}
8484

85-
require.Equal(t, "#include <Arduino.h>\n#line 1 " + quotedSketchLocation + "\n", ctx.IncludeSection)
85+
require.Equal(t, "#include <Arduino.h>\n#line 1 "+quotedSketchLocation+"\n", ctx.IncludeSection)
8686
require.Equal(t, "#line 33 "+quotedSketchLocation+"\nvoid setup();\n#line 46 "+quotedSketchLocation+"\nvoid loop();\n#line 62 "+quotedSketchLocation+"\nvoid process(BridgeClient client);\n#line 82 "+quotedSketchLocation+"\nvoid digitalCommand(BridgeClient client);\n#line 109 "+quotedSketchLocation+"\nvoid analogCommand(BridgeClient client);\n#line 149 "+quotedSketchLocation+"\nvoid modeCommand(BridgeClient client);\n#line 33 "+quotedSketchLocation+"\n", ctx.PrototypesSection)
8787
}
8888

src/arduino.cc/builder/test/time_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
package test
3131

3232
import (
33-
"arduino.cc/builder/utils"
34-
"github.com/stretchr/testify/require"
3533
"testing"
3634
"time"
35+
36+
"arduino.cc/builder/utils"
37+
"github.com/stretchr/testify/require"
3738
)
3839

3940
func TestTime(t *testing.T) {

src/arduino.cc/builder/test/utils_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ func TestMapTrimSpace(t *testing.T) {
8989
}
9090

9191
func TestQuoteCppString(t *testing.T) {
92-
cases := map[string]string {
93-
`foo`: `"foo"`,
92+
cases := map[string]string{
93+
`foo`: `"foo"`,
9494
`foo\bar`: `"foo\\bar"`,
9595
`foo "is" quoted and \\bar"" escaped\`: `"foo \"is\" quoted and \\\\bar\"\" escaped\\"`,
9696
// ASCII 0x20 - 0x7e, excluding `
@@ -123,7 +123,7 @@ func TestParseCppString(t *testing.T) {
123123
require.Equal(t, `foo "is" quoted and \\bar"" escaped\`, str)
124124
require.Equal(t, ` and "then" some`, rest)
125125

126-
str, rest, ok = utils.ParseCppString(`" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~"`,)
126+
str, rest, ok = utils.ParseCppString(`" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~"`)
127127
require.Equal(t, true, ok)
128128
require.Equal(t, ` !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmnopqrstuvwxyz{|}~`, str)
129129
require.Equal(t, ``, rest)

src/arduino.cc/builder/types/types.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ package types
3232
import (
3333
"arduino.cc/builder/constants"
3434
"arduino.cc/builder/props"
35+
"os"
3536
"path/filepath"
3637
"strconv"
37-
"os"
3838
)
3939

4040
type SketchFile struct {
@@ -174,8 +174,8 @@ type SourceFolder struct {
174174
}
175175

176176
type LibraryResolutionResult struct {
177-
Library *Library
178-
NotUsedLibraries []*Library
177+
Library *Library
178+
NotUsedLibraries []*Library
179179
}
180180

181181
type CTag struct {

src/arduino.cc/builder/utils/utils.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -440,21 +440,21 @@ func ParseCppString(line string) (string, string, bool) {
440440
return "", line, false
441441
}
442442

443-
switch (line[i]) {
444-
// Backslash, next character is used unmodified
445-
case '\\':
446-
i++
447-
if i >= len(line) {
448-
return "", line, false
449-
}
450-
res += string(line[i])
451-
break
452-
// Quote, end of string
453-
case '"':
454-
return res, line[i+1:], true
455-
default:
456-
res += string(line[i])
457-
break
443+
switch line[i] {
444+
// Backslash, next character is used unmodified
445+
case '\\':
446+
i++
447+
if i >= len(line) {
448+
return "", line, false
449+
}
450+
res += string(line[i])
451+
break
452+
// Quote, end of string
453+
case '"':
454+
return res, line[i+1:], true
455+
default:
456+
res += string(line[i])
457+
break
458458
}
459459

460460
i++

0 commit comments

Comments
 (0)