Skip to content

Commit fd224a6

Browse files
committed
Merge pull request #8 from matthijskooijman/fixes
Fix error output and other minor fixes
2 parents 4d998e1 + 0bc1e53 commit fd224a6

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bin
22
src/github.com
33
src/golang.org
4-
go-arduino-compiler
4+
arduino-builder
55

66
# Created by .ignore support plugin (hsz.mobi)
77
### Go template

main.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func main() {
119119
dumpPrefs := *dumpPrefsFlag
120120

121121
if compile && dumpPrefs {
122-
fmt.Println("You can either specify --compile or --dump-prefs, not both")
122+
fmt.Fprintln(os.Stderr, "You can either specify --compile or --dump-prefs, not both")
123123
defer os.Exit(1)
124124
return
125125
}
@@ -138,7 +138,7 @@ func main() {
138138
}
139139

140140
if len(hardware) == 0 {
141-
fmt.Println("Parameter 'hardware' is mandatory")
141+
fmt.Fprintln(os.Stderr, "Parameter 'hardware' is mandatory")
142142
flag.Usage()
143143
defer os.Exit(1)
144144
return
@@ -153,7 +153,7 @@ func main() {
153153
}
154154

155155
if len(tools) == 0 {
156-
fmt.Println("Parameter 'tools' is mandatory")
156+
fmt.Fprintln(os.Stderr, "Parameter 'tools' is mandatory")
157157
flag.Usage()
158158
defer os.Exit(1)
159159
return
@@ -184,7 +184,7 @@ func main() {
184184
}
185185

186186
if fqbn == "" {
187-
fmt.Println("Parameter 'fqbn' is mandatory")
187+
fmt.Fprintln(os.Stderr, "Parameter 'fqbn' is mandatory")
188188
flag.Usage()
189189
defer os.Exit(1)
190190
return
@@ -201,7 +201,7 @@ func main() {
201201
if buildPath != "" {
202202
_, err := os.Stat(buildPath)
203203
if err != nil {
204-
fmt.Println(err)
204+
fmt.Fprintln(os.Stderr, err)
205205
defer os.Exit(1)
206206
return
207207
}
@@ -216,7 +216,7 @@ func main() {
216216
context[constants.CTX_BUILD_PATH] = buildPath
217217

218218
if compile && flag.NArg() == 0 {
219-
fmt.Println("Last parameter must be the sketch to compile")
219+
fmt.Fprintln(os.Stderr, "Last parameter must be the sketch to compile")
220220
flag.Usage()
221221
defer os.Exit(1)
222222
return
@@ -264,10 +264,10 @@ func main() {
264264
if err != nil {
265265
err = utils.WrapError(err)
266266

267-
fmt.Println(err)
267+
fmt.Fprintln(os.Stderr, err)
268268

269269
if utils.DebugLevel(context) >= 10 {
270-
fmt.Println(err.(*errors.Error).ErrorStack())
270+
fmt.Fprintln(os.Stderr, err.(*errors.Error).ErrorStack())
271271
}
272272

273273
exitCode = toExitCode(err)
@@ -299,5 +299,5 @@ func toSliceOfUnquoted(value slice) ([]string, error) {
299299

300300
func printCompleteError(err error) {
301301
err = utils.WrapError(err)
302-
fmt.Println(err.(*errors.Error).ErrorStack())
302+
fmt.Fprintln(os.Stderr, err.(*errors.Error).ErrorStack())
303303
}

src/arduino.cc/builder/constants/constants.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const CTX_DEBUG_LEVEL = "debugLevel"
8181
const CTX_FIRST_FUNCTION_AT_LINE = "firstFunctionAtLine"
8282
const CTX_FQBN = "fqbn"
8383
const CTX_GCC_MINUS_E_SOURCE = "gccMinusESource"
84-
const CTX_GCC_MINUS_M_OUTPUT = "gccMinusMOutout"
84+
const CTX_GCC_MINUS_M_OUTPUT = "gccMinusMOutput"
8585
const CTX_HARDWARE_FOLDERS = "hardwareFolders"
8686
const CTX_HARDWARE = "hardware"
8787
const CTX_HEADER_TO_LIBRARIES = "headerToLibraries"

0 commit comments

Comments
 (0)