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

Issue 5624047: code review 5624047: go/scanner: clean up error interface (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 3 months ago by gri
Modified:
12 years, 3 months ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

go/scanner: clean up error interface Issue 2856 asks for a rename of a few methods to a more idiomatic Go style. This is a very early API that evolved organically throughout the years. Together with the fact that ErrorVectors were embedded in other data structures (e.g. Parser), just renaming methods (e.g. GetError -> Error) would lead to undesired behavior (e.g., Parser would act like an Error). Instead, cleaned up API a bit more: - removed ErrorVector in favor of ErrorList (already present) - simplified Scanner.Init by making the error handler a function instead of requiring an ErrorHandler implementation - adjusted helper functions accordingly - updated Go 1 doc Fixes issue 2856.

Patch Set 1 #

Patch Set 2 : diff -r d267ecc8b934 https://code.google.com/p/go #

Patch Set 3 : diff -r 389444436d35 https://code.google.com/p/go #

Patch Set 4 : diff -r 389444436d35 https://code.google.com/p/go #

Patch Set 5 : diff -r 389444436d35 https://code.google.com/p/go #

Patch Set 6 : diff -r 389444436d35 https://code.google.com/p/go #

Total comments: 4

Patch Set 7 : diff -r 97736bb869c4 https://code.google.com/p/go #

Patch Set 8 : diff -r 34e1fd6b8b79 https://code.google.com/p/go #

Patch Set 9 : diff -r 34e1fd6b8b79 https://code.google.com/p/go #

Patch Set 10 : diff -r d739d7e8b0e6 https://code.google.com/p/go #

Total comments: 1

Patch Set 11 : diff -r d739d7e8b0e6 https://code.google.com/p/go #

Patch Set 12 : diff -r 36c9c7810f14 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+128 lines, -138 lines) Patch
M doc/go1.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +10 lines, -0 lines 0 comments Download
M doc/go1.tmpl View 1 2 3 4 5 6 7 8 9 10 1 chunk +10 lines, -0 lines 0 comments Download
M src/pkg/exp/types/check.go View 1 2 3 4 5 6 7 2 chunks +6 lines, -5 lines 0 comments Download
M src/pkg/go/ast/resolve.go View 1 2 3 4 5 6 7 2 chunks +5 lines, -4 lines 0 comments Download
M src/pkg/go/parser/interface.go View 1 2 3 4 5 6 7 1 chunk +13 lines, -1 line 0 comments Download
M src/pkg/go/parser/parser.go View 1 5 chunks +6 lines, -13 lines 0 comments Download
M src/pkg/go/scanner/errors.go View 1 2 3 4 5 6 3 chunks +47 lines, -88 lines 0 comments Download
M src/pkg/go/scanner/scanner.go View 1 2 3 4 3 chunks +9 lines, -2 lines 0 comments Download
M src/pkg/go/scanner/scanner_test.go View 1 2 3 4 chunks +22 lines, -25 lines 0 comments Download

Messages

Total messages: 7
gri
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
12 years, 3 months ago (2012-02-03 23:54:13 UTC) #1
rsc
http://codereview.appspot.com/5624047/diff/1003/doc/go1.tmpl File doc/go1.tmpl (right): http://codereview.appspot.com/5624047/diff/1003/doc/go1.tmpl#newcode865 doc/go1.tmpl:865: an <code>ErrorVector</code> in a client of the scanner, now ...
12 years, 3 months ago (2012-02-06 17:38:17 UTC) #2
gri
PTAL http://codereview.appspot.com/5624047/diff/1003/doc/go1.tmpl File doc/go1.tmpl (right): http://codereview.appspot.com/5624047/diff/1003/doc/go1.tmpl#newcode865 doc/go1.tmpl:865: an <code>ErrorVector</code> in a client of the scanner, ...
12 years, 3 months ago (2012-02-06 17:43:37 UTC) #3
gri
One sec. This needs some other adjustments. - gri On Mon, Feb 6, 2012 at ...
12 years, 3 months ago (2012-02-06 17:45:42 UTC) #4
gri
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 3 months ago (2012-02-06 18:00:57 UTC) #5
rsc
LGTM Sorry about the delay. http://codereview.appspot.com/5624047/diff/14001/doc/go1.tmpl File doc/go1.tmpl (right): http://codereview.appspot.com/5624047/diff/14001/doc/go1.tmpl#newcode954 doc/go1.tmpl:954: an <code>ErrorList</code> instead. s/ ...
12 years, 3 months ago (2012-02-08 19:30:46 UTC) #6
gri
12 years, 3 months ago (2012-02-08 19:41:34 UTC) #7
*** Submitted as 531a26e7c3bf ***

go/scanner: clean up error interface

Issue 2856 asks for a rename of a few methods to a
more idiomatic Go style. This is a very early API
that evolved organically throughout the years.
Together with the fact that ErrorVectors were embedded
in other data structures (e.g. Parser), just renaming
methods (e.g. GetError -> Error) would lead to undesired
behavior (e.g., Parser would act like an Error). Instead,
cleaned up API a bit more:

- removed ErrorVector in favor of ErrorList (already
present)
- simplified Scanner.Init by making the error handler a
function instead of requiring an ErrorHandler implementation
- adjusted helper functions accordingly
- updated Go 1 doc

Fixes issue 2856.

R=rsc
CC=golang-dev
http://codereview.appspot.com/5624047
Sign in to reply to this message.

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