mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 4th set of files. R=rsc CC=golang-dev https://golang.org/cl/180049
28 lines
619 B
Go
28 lines
619 B
Go
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package syscall
|
|
|
|
|
|
func str(val int) string { // do it here rather than with fmt to avoid dependency
|
|
if val < 0 {
|
|
return "-" + str(-val)
|
|
}
|
|
var buf [32]byte // big enough for int64
|
|
i := len(buf) - 1
|
|
for val >= 10 {
|
|
buf[i] = byte(val%10 + '0')
|
|
i--
|
|
val /= 10
|
|
}
|
|
buf[i] = byte(val + '0')
|
|
return string(buf[i:])
|
|
}
|
|
|
|
func Errstr(errno int) string {
|
|
if errno < 0 || errno >= int(len(errors)) {
|
|
return "error " + str(errno)
|
|
}
|
|
return errors[errno]
|
|
}
|