Run gofmt

This commit is contained in:
Thomas Pelletier
2014-08-07 12:52:42 +02:00
parent aa194b5c41
commit bf549a2194
4 changed files with 39 additions and 40 deletions
+3 -3
View File
@@ -65,7 +65,7 @@ func (i token) String() string {
}
func (i token) Pos() string {
return fmt.Sprintf("(%d, %d)", i.line + 1, i.col + 1)
return fmt.Sprintf("(%d, %d)", i.line+1, i.col+1)
}
func isSpace(r rune) bool {
@@ -113,7 +113,7 @@ func (l *lexer) run() {
func (l *lexer) nextStart() {
// iterate by runes (utf8 characters)
// search for newlines and advance line/col counts
for i:=l.start; i<l.pos; {
for i := l.start; i < l.pos; {
r, width := utf8.DecodeRuneInString(l.input[i:])
if r == '\n' {
l.line += 1
@@ -122,7 +122,7 @@ func (l *lexer) nextStart() {
l.col += 1
}
i += width
// fmt.Printf("'%c'\n", r)
// fmt.Printf("'%c'\n", r)
}
// advance start position to next token
l.start = l.pos
+1 -2
View File
@@ -125,7 +125,6 @@ func TestKeyWithSharpAndEqual(t *testing.T) {
})
}
func TestKeyWithSymbolsAndEqual(t *testing.T) {
testFlow(t, "~!@#$^&*()_+-`1234567890[]\\|/?><.,;:' = 5", []token{
token{tokenKey, "~!@#$^&*()_+-`1234567890[]\\|/?><.,;:'", 0, 0},
@@ -139,7 +138,7 @@ func TestKeyEqualStringEscape(t *testing.T) {
testFlow(t, `foo = "hello\""`, []token{
token{tokenKey, "foo", 0, 0},
token{tokenEqual, "=", 0, 4},
token{tokenString, "hello\"" ,0, 7},
token{tokenString, "hello\"", 0, 7},
token{tokenEOF, "", 0, 15},
})
}
+1 -1
View File
@@ -21,7 +21,7 @@ type parser struct {
type parserStateFn func(*parser) parserStateFn
// Formats and panics an error message based on a token
func (p *parser) raiseError(tok *token, msg string, args... interface{}) {
func (p *parser) raiseError(tok *token, msg string, args ...interface{}) {
panic(tok.Pos() + ": " + fmt.Sprintf(msg, args...))
}
+1 -1
View File
@@ -144,7 +144,7 @@ func (t *TomlTree) SetPath(keys []string, value interface{}) {
// and tree[a][b][c]
//
// Returns nil on success, error object on failure
func (t *TomlTree) createSubTree(key string) error{
func (t *TomlTree) createSubTree(key string) error {
subtree := t
for _, intermediate_key := range strings.Split(key, ".") {
if intermediate_key == "" {