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

Unified Diff: src/pkg/go/token/position.go

Issue 12837044: code review 12837044: cmd/gofmt: sort more, remove some duplicate imports (Closed)
Patch Set: diff -r ec64f75a7995 https://code.google.com/p/go Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/go/ast/import.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/go/token/position.go
===================================================================
--- a/src/pkg/go/token/position.go
+++ b/src/pkg/go/token/position.go
@@ -136,6 +136,15 @@
f.set.mutex.Unlock()
}
+// RemoveLine removes a line by line number as reported by Position.Line.
gri 2013/09/10 20:51:05 RemoveLine is slightly misleading a name. This fu
josharian 2013/09/10 23:34:49 Agreed. I started with RemoveNewline, was unsure a
+//
+func (f *File) RemoveLine(line int) {
+ f.set.mutex.Lock()
+ copy(f.lines[line:], f.lines[line+1:])
+ f.lines = f.lines[:len(f.lines)-1]
+ f.set.mutex.Unlock()
+}
+
// SetLines sets the line offsets for a file and returns true if successful.
// The line offsets are the offsets of the first character of each line;
// for instance for the content "ab\nc\n" the line offsets are {0, 3}.
« no previous file with comments | « src/pkg/go/ast/import.go ('k') | no next file » | no next file with comments »

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