Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1006)

Delta Between Two Patch Sets: src/cmd/gofix/htmlerr.go

Issue 5327064: code review 5327064: html,bzip2,sql: rename Error methods that return error ... (Closed)
Left Patch Set: Created 13 years, 4 months ago
Right Patch Set: diff -r a08ea6d0b200 https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/gofix/fix.go ('k') | src/cmd/gofix/htmlerr_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package main
6
7 import (
8 "go/ast"
9 )
10
11 func init() {
12 register(htmlerrFix)
13 }
14
15 var htmlerrFix = fix{
16 "htmlerr",
17 "2011-11-04",
18 htmlerr,
19 `Rename html's Tokenizer.Error method to Err.
20
21 http://codereview.appspot.com/5327064/
22 `,
23 }
24
25 var htmlerrTypeConfig = &TypeConfig{
26 Func: map[string]string{
27 "html.NewTokenizer": "html.Tokenizer",
28 },
29 }
30
31 func htmlerr(f *ast.File) bool {
32 if !imports(f, "html") {
33 return false
34 }
35
36 typeof, _ := typecheck(htmlerrTypeConfig, f)
37
38 fixed := false
39 walk(f, func(n interface{}) {
40 s, ok := n.(*ast.SelectorExpr)
41 if ok && typeof[s.X] == "html.Tokenizer" && s.Sel.Name == "Error " {
42 s.Sel.Name = "Err"
43 fixed = true
44 }
45 })
46 return fixed
47 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b