Skip to content

Commit 6d0edc0

Browse files
committed
Round of go fmt
Signed-off-by: Cristian Maglie <[email protected]>
1 parent d71753a commit 6d0edc0

File tree

7 files changed

+53
-56
lines changed

7 files changed

+53
-56
lines changed

Diff for: fmt_fix_vet

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/bin/bash -x
22

3-
go fmt ./src/arduino.cc/builder/...
4-
go fmt ./src/arduino.cc/arduino-builder/...
5-
go fix ./src/arduino.cc/builder/...
6-
go fix ./src/arduino.cc/arduino-builder/...
7-
go vet ./src/arduino.cc/builder/...
8-
go vet ./src/arduino.cc/arduino-builder/...
3+
go fmt ./src/arduino.cc/...
4+
go fix ./src/arduino.cc/...
5+
go vet ./src/arduino.cc/...

Diff for: src/arduino.cc/builder/container_find_includes.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
139139
ctx.CollectedSourceFiles.Push(mergedfile)
140140

141141
sourceFilePaths := ctx.CollectedSourceFiles
142-
queueSourceFilesFromFolder(ctx, sourceFilePaths, sketch, ctx.SketchBuildPath, /* recurse */ false)
142+
queueSourceFilesFromFolder(ctx, sourceFilePaths, sketch, ctx.SketchBuildPath, false /* recurse */)
143143
srcSubfolderPath := filepath.Join(ctx.SketchBuildPath, constants.SKETCH_FOLDER_SRC)
144144
if info, err := os.Stat(srcSubfolderPath); err == nil && info.IsDir() {
145-
queueSourceFilesFromFolder(ctx, sourceFilePaths, sketch, srcSubfolderPath, /* recurse */ true)
145+
queueSourceFilesFromFolder(ctx, sourceFilePaths, sketch, srcSubfolderPath, true /* recurse */)
146146
}
147147

148148
for !sourceFilePaths.Empty() {
@@ -195,7 +195,7 @@ type includeCacheEntry struct {
195195

196196
type includeCache struct {
197197
// Are the cache contents valid so far?
198-
valid bool
198+
valid bool
199199
// Index into entries of the next entry to be processed. Unused
200200
// when the cache is invalid.
201201
next int
@@ -373,7 +373,7 @@ func queueSourceFilesFromFolder(ctx *types.Context, queue *types.UniqueSourceFil
373373

374374
for _, filePath := range filePaths {
375375
sourceFile, err := types.MakeSourceFile(ctx, origin, filePath)
376-
if (err != nil) {
376+
if err != nil {
377377
return i18n.WrapError(err)
378378
}
379379
queue.Push(sourceFile)

Diff for: src/arduino.cc/builder/gcc_preproc_runner.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import (
4444
type GCCPreprocRunner struct {
4545
SourceFilePath string
4646
TargetFileName string
47-
Includes []string
47+
Includes []string
4848
}
4949

5050
func (s *GCCPreprocRunner) Run(ctx *types.Context) error {
@@ -73,7 +73,7 @@ func (s *GCCPreprocRunner) Run(ctx *types.Context) error {
7373
type GCCPreprocRunnerForDiscoveringIncludes struct {
7474
SourceFilePath string
7575
TargetFilePath string
76-
Includes []string
76+
Includes []string
7777
}
7878

7979
func (s *GCCPreprocRunnerForDiscoveringIncludes) Run(ctx *types.Context) error {

Diff for: src/arduino.cc/builder/test/includes_to_include_folders_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ package test
3232
import (
3333
"arduino.cc/builder"
3434
"arduino.cc/builder/types"
35+
"fmt"
3536
"github.com/stretchr/testify/require"
3637
"os"
3738
"path/filepath"
3839
"sort"
3940
"testing"
40-
"fmt"
4141
)
4242

4343
func TestIncludesToIncludeFolders(t *testing.T) {
@@ -339,4 +339,3 @@ func TestIncludesToIncludeFoldersSubfolders(t *testing.T) {
339339
require.Equal(t, "testlib2", importedLibraries[1].Name)
340340
require.Equal(t, "testlib3", importedLibraries[2].Name)
341341
}
342-

Diff for: src/arduino.cc/builder/types/context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type Context struct {
4646
PreprocPath string
4747
SketchObjectFiles []string
4848

49-
CollectedSourceFiles *UniqueSourceFileQueue
49+
CollectedSourceFiles *UniqueSourceFileQueue
5050

5151
Sketch *Sketch
5252
Source string

Diff for: src/arduino.cc/builder/types/types.go

+37-37
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ import (
4040

4141
type SourceFile struct {
4242
// Sketch or Library pointer that this source file lives in
43-
Origin interface{}
43+
Origin interface{}
4444
// Path to the source file within the sketch/library root folder
45-
RelativePath string
45+
RelativePath string
4646
}
4747

4848
// Create a SourceFile containing the given source file path within the
@@ -63,40 +63,40 @@ func MakeSourceFile(ctx *Context, origin interface{}, path string) (SourceFile,
6363
// be placed. Any directories inside SourceFile.RelativePath will be
6464
// appended here.
6565
func buildRoot(ctx *Context, origin interface{}) string {
66-
switch o := origin.(type) {
67-
case *Sketch:
68-
return ctx.SketchBuildPath
69-
case *Library:
70-
return filepath.Join(ctx.LibrariesBuildPath, o.Name)
71-
default:
72-
panic("Unexpected origin for SourceFile: " + fmt.Sprint(origin))
73-
}
66+
switch o := origin.(type) {
67+
case *Sketch:
68+
return ctx.SketchBuildPath
69+
case *Library:
70+
return filepath.Join(ctx.LibrariesBuildPath, o.Name)
71+
default:
72+
panic("Unexpected origin for SourceFile: " + fmt.Sprint(origin))
73+
}
7474
}
7575

7676
// Return the source root for the given origin, where its source files
7777
// can be found. Prepending this to SourceFile.RelativePath will give
7878
// the full path to that source file.
7979
func sourceRoot(ctx *Context, origin interface{}) string {
80-
switch o := origin.(type) {
81-
case *Sketch:
82-
return ctx.SketchBuildPath
83-
case *Library:
84-
return o.SrcFolder
85-
default:
86-
panic("Unexpected origin for SourceFile: " + fmt.Sprint(origin))
87-
}
80+
switch o := origin.(type) {
81+
case *Sketch:
82+
return ctx.SketchBuildPath
83+
case *Library:
84+
return o.SrcFolder
85+
default:
86+
panic("Unexpected origin for SourceFile: " + fmt.Sprint(origin))
87+
}
8888
}
8989

9090
func (f *SourceFile) SourcePath(ctx *Context) string {
91-
return filepath.Join(sourceRoot(ctx, f.Origin), f.RelativePath)
91+
return filepath.Join(sourceRoot(ctx, f.Origin), f.RelativePath)
9292
}
9393

9494
func (f *SourceFile) ObjectPath(ctx *Context) string {
95-
return filepath.Join(buildRoot(ctx, f.Origin), f.RelativePath + ".o")
95+
return filepath.Join(buildRoot(ctx, f.Origin), f.RelativePath+".o")
9696
}
9797

9898
func (f *SourceFile) DepfilePath(ctx *Context) string {
99-
return filepath.Join(buildRoot(ctx, f.Origin), f.RelativePath + ".d")
99+
return filepath.Join(buildRoot(ctx, f.Origin), f.RelativePath+".d")
100100
}
101101

102102
type SketchFile struct {
@@ -163,23 +163,23 @@ const (
163163
)
164164

165165
type Library struct {
166-
Folder string
167-
SrcFolder string
166+
Folder string
167+
SrcFolder string
168168
UtilityFolder string
169-
Layout LibraryLayout
170-
Name string
171-
Archs []string
172-
DotALinkage bool
173-
IsLegacy bool
174-
Version string
175-
Author string
176-
Maintainer string
177-
Sentence string
178-
Paragraph string
179-
URL string
180-
Category string
181-
License string
182-
Properties map[string]string
169+
Layout LibraryLayout
170+
Name string
171+
Archs []string
172+
DotALinkage bool
173+
IsLegacy bool
174+
Version string
175+
Author string
176+
Maintainer string
177+
Sentence string
178+
Paragraph string
179+
URL string
180+
Category string
181+
License string
182+
Properties map[string]string
183183
}
184184

185185
func (library *Library) String() string {

Diff for: src/arduino.cc/builder/utils/utils.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
package utils
3131

3232
import (
33-
"arduino.cc/builder/constants"
34-
"arduino.cc/builder/gohasissues"
35-
"arduino.cc/builder/i18n"
36-
"arduino.cc/builder/types"
3733
"crypto/md5"
3834
"encoding/hex"
3935
"io/ioutil"
@@ -42,6 +38,11 @@ import (
4238
"path/filepath"
4339
"runtime"
4440
"strings"
41+
42+
"arduino.cc/builder/constants"
43+
"arduino.cc/builder/gohasissues"
44+
"arduino.cc/builder/i18n"
45+
"arduino.cc/builder/types"
4546
)
4647

4748
func KeysOfMapOfStringInterface(input map[string]interface{}) []string {

0 commit comments

Comments
 (0)