summaryrefslogtreecommitdiff
path: root/src/pkg/go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/go')
-rw-r--r--src/pkg/go/ast/ast.go2
-rw-r--r--src/pkg/go/doc/comment.go10
-rw-r--r--src/pkg/go/doc/doc.go2
-rw-r--r--src/pkg/go/parser/interface.go2
-rw-r--r--src/pkg/go/parser/parser.go2
-rw-r--r--src/pkg/go/parser/parser_test.go6
-rw-r--r--src/pkg/go/printer/printer.go2
-rw-r--r--src/pkg/go/scanner/scanner_test.go6
8 files changed, 16 insertions, 16 deletions
diff --git a/src/pkg/go/ast/ast.go b/src/pkg/go/ast/ast.go
index 3cddf4f1d..b0cb6bfe8 100644
--- a/src/pkg/go/ast/ast.go
+++ b/src/pkg/go/ast/ast.go
@@ -350,7 +350,7 @@ func (x *ChanType) exprNode() {}
// IsExported returns whether name is an exported Go symbol
// (i.e., whether it begins with an uppercase letter).
func IsExported(name string) bool {
- ch, len := utf8.DecodeRuneInString(name);
+ ch, _ := utf8.DecodeRuneInString(name);
return unicode.IsUpper(ch);
}
diff --git a/src/pkg/go/doc/comment.go b/src/pkg/go/doc/comment.go
index 0550e7331..de127ff4b 100644
--- a/src/pkg/go/doc/comment.go
+++ b/src/pkg/go/doc/comment.go
@@ -43,13 +43,13 @@ func setupRegexps() {
func commentText(comments []string) string {
once.Do(setupRegexps);
lines := make([]string, 0, 20);
- for i, c := range comments {
+ for _, c := range comments {
// split on newlines
cl := strings.Split(c, "\n", 0);
// walk lines, stripping comment markers
w := 0;
- for j, l := range cl {
+ for _, l := range cl {
// remove /* and */ lines
if comment_junk.MatchString(l) {
continue;
@@ -85,7 +85,7 @@ func commentText(comments []string) string {
// add this comment to total list
// TODO: maybe separate with a single blank line
// if there is already a comment and len(cl) > 0?
- for j, l := range cl {
+ for _, l := range cl {
n := len(lines);
if n+1 >= cap(lines) {
newlines := make([]string, n, 2*cap(lines));
@@ -205,7 +205,7 @@ func unindent(block [][]byte) {
// compute maximum common white prefix
prefix := block[0][0 : indentLen(block[0])];
- for i, line := range block {
+ for _, line := range block {
if !isBlank(line) {
prefix = commonPrefix(prefix, line[0 : indentLen(line)]);
}
@@ -288,7 +288,7 @@ func ToHtml(w io.Writer, s []byte) {
// they don't get the nice text formatting,
// just html escaping
w.Write(html_pre);
- for k, line := range block {
+ for _, line := range block {
template.HtmlEscape(w, line);
}
w.Write(html_endpre);
diff --git a/src/pkg/go/doc/doc.go b/src/pkg/go/doc/doc.go
index 7f44eac60..0fcb7d860 100644
--- a/src/pkg/go/doc/doc.go
+++ b/src/pkg/go/doc/doc.go
@@ -563,7 +563,7 @@ func isRegexp(s string) bool {
func match(s string, a []string) bool {
for _, t := range a {
if isRegexp(t) {
- if matched, err := regexp.MatchString(t, s); matched {
+ if matched, _ := regexp.MatchString(t, s); matched {
return true;
}
}
diff --git a/src/pkg/go/parser/interface.go b/src/pkg/go/parser/interface.go
index d840e9a4a..bc13e2e51 100644
--- a/src/pkg/go/parser/interface.go
+++ b/src/pkg/go/parser/interface.go
@@ -38,7 +38,7 @@ func readSource(filename string, src interface{}) ([]byte, os.Error) {
}
case io.Reader:
var buf bytes.Buffer;
- n, err := io.Copy(s, &buf);
+ _, err := io.Copy(s, &buf);
if err != nil {
return nil, err;
}
diff --git a/src/pkg/go/parser/parser.go b/src/pkg/go/parser/parser.go
index de44ed865..34d6146f8 100644
--- a/src/pkg/go/parser/parser.go
+++ b/src/pkg/go/parser/parser.go
@@ -650,7 +650,7 @@ func (p *parser) parseMethodSpec() *ast.Field {
var idents []*ast.Ident;
var typ ast.Expr;
x := p.parseQualifiedIdent();
- if tmp, isIdent := x.(*ast.Ident); isIdent && (p.tok == token.COMMA || p.tok == token.LPAREN) {
+ if _, isIdent := x.(*ast.Ident); isIdent && (p.tok == token.COMMA || p.tok == token.LPAREN) {
// methods
idents = p.parseIdentList(x);
params, results := p.parseSignature();
diff --git a/src/pkg/go/parser/parser_test.go b/src/pkg/go/parser/parser_test.go
index 7a0b24d07..03a92d166 100644
--- a/src/pkg/go/parser/parser_test.go
+++ b/src/pkg/go/parser/parser_test.go
@@ -21,7 +21,7 @@ var illegalInputs = []interface{} {
func TestParseIllegalInputs(t *testing.T) {
for _, src := range illegalInputs {
- prog, err := ParseFile("", src, 0);
+ _, err := ParseFile("", src, 0);
if err == nil {
t.Errorf("ParseFile(%v) should have failed", src);
}
@@ -37,7 +37,7 @@ var validPrograms = []interface{} {
func TestParseValidPrograms(t *testing.T) {
for _, src := range validPrograms {
- prog, err := ParseFile("", src, 0);
+ _, err := ParseFile("", src, 0);
if err != nil {
t.Errorf("ParseFile(%q): %v", src, err);
}
@@ -53,7 +53,7 @@ var validFiles = []string {
func TestParse3(t *testing.T) {
for _, filename := range validFiles {
- prog, err := ParseFile(filename, nil, 0);
+ _, err := ParseFile(filename, nil, 0);
if err != nil {
t.Errorf("ParseFile(%s): %v", filename, err);
}
diff --git a/src/pkg/go/printer/printer.go b/src/pkg/go/printer/printer.go
index ac8cd88e5..84a053495 100644
--- a/src/pkg/go/printer/printer.go
+++ b/src/pkg/go/printer/printer.go
@@ -847,7 +847,7 @@ func (p *printer) block(s *ast.BlockStmt) {
func (p *printer) switchBlock(s *ast.BlockStmt) {
p.print(s.Pos(), token.LBRACE);
if len(s.List) > 0 {
- for i, s := range s.List {
+ for _, s := range s.List {
// s is one of *ast.CaseClause, *ast.TypeCaseClause, *ast.CommClause;
p.print(newline);
p.stmt(s);
diff --git a/src/pkg/go/scanner/scanner_test.go b/src/pkg/go/scanner/scanner_test.go
index 52a483c52..d243a8429 100644
--- a/src/pkg/go/scanner/scanner_test.go
+++ b/src/pkg/go/scanner/scanner_test.go
@@ -282,7 +282,7 @@ func TestLineComments(t *testing.T) {
var S Scanner;
S.Init("TestLineComments", strings.Bytes(src), nil, 0);
for _, s := range segments {
- pos, tok, lit := S.Scan();
+ pos, _, lit := S.Scan();
checkPos(t, string(lit), pos, token.Position{s.filename, pos.Offset, s.line, pos.Column});
}
@@ -300,14 +300,14 @@ func TestInit(t *testing.T) {
s.Init("", strings.Bytes("if true { }"), nil, 0);
s.Scan(); // if
s.Scan(); // true
- pos, tok, lit := s.Scan(); // {
+ _, tok, _ := s.Scan(); // {
if tok != token.LBRACE {
t.Errorf("bad token: got %s, expected %s", tok.String(), token.LBRACE);
}
// 2nd init
s.Init("", strings.Bytes("go true { ]"), nil, 0);
- pos, tok, lit = s.Scan(); // go
+ _, tok, _ = s.Scan(); // go
if tok != token.GO {
t.Errorf("bad token: got %s, expected %s", tok.String(), token.GO);
}