1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:21:22 -06:00
Commit Graph

67 Commits

Author SHA1 Message Date
Russ Cox
00ffd59c1a gc: fix reflect table method receiver
Fixes #451.
Fixes #770.

R=ken2
CC=golang-dev
https://golang.org/cl/2207045
2010-09-28 13:43:50 -04:00
Russ Cox
2ee420fa5e ... changes
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/2273042
2010-09-24 11:55:48 -04:00
Scott Lawrence
825e0deece template: fixed documentation formatting
What was meant to be a list appeared as a paragraph with dashes.

R=golang-dev, gri1, gri
CC=golang-dev
https://golang.org/cl/2100041
2010-08-31 19:07:40 -07:00
Rob Pike
b5664ee320 template: finally fix space handling around actions.
Rewrite the code to express the intention more clearly.

Fixes #1042.

R=rsc
CC=golang-dev
https://golang.org/cl/2011046
2010-08-28 07:52:55 +10:00
Russ Cox
da392d9136 build: no required environment variables
R=adg, r, PeterGo
CC=golang-dev
https://golang.org/cl/1942044
2010-08-18 10:08:49 -04:00
Roger Peppe
781c54d06c Fix template package so that data items
preceded by white space parse correctly.

R=r
CC=golang-dev
https://golang.org/cl/2010041
2010-08-17 23:13:07 +10:00
Rob Pike
30ab8cf792 template: retain leading space if the line is not an action.
R=rsc
CC=golang-dev
https://golang.org/cl/1985042
2010-08-17 09:44:16 +10:00
Scott Lawrence
bca3151042 template: added ParseFile method for template.Template
Fixes #971.

Parse/ParseFile methods of Template now match template.Parse and .ParseFile methods.
Also made tests being run on Parse and ParseFile be run on Template.ParseFile as well.

R=r
CC=golang-dev
https://golang.org/cl/1741059
2010-08-11 14:04:03 +10:00
Rob Pike
38f1231f3e strings and bytes.Split: make count of 0 mean 0, not infinite.
Use a count of -1 for infinity.  Ditto for Replace.

R=rsc
CC=golang-dev
https://golang.org/cl/1704044
2010-07-01 14:08:14 -07:00
Daniel Fleischman
040f081842 template: fix typo in doc comment
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/1665047
2010-06-30 19:57:26 -07:00
Rob Pike
b717768b94 template: regularize the handling of interfaces, pointers, and
methods when looking up names.
Fixes #764.

R=rsc
CC=golang-dev
https://golang.org/cl/1170041
2010-05-09 16:40:38 -07:00
Andrew Gerrand
8553b9c68f template: remove reference to json-template
Rather than confuse people by linking to a spec we
don't fully support, let them just use the package docs.

R=r, rsc
CC=golang-dev
https://golang.org/cl/1016041
2010-04-28 10:14:58 +10:00
Russ Cox
13bb28a40a template: fix handling of pointer inside interface
R=r
CC=golang-dev
https://golang.org/cl/982043
2010-04-26 10:01:13 -07:00
Russ Cox
dba9d62bc2 json: Marshal, Unmarshal using new scanner
R=r
CC=golang-dev
https://golang.org/cl/953041
2010-04-21 16:40:53 -07:00
Rob Pike
effddcadc4 template: use panic/recover to simplify internal error handling.
R=rsc
CC=golang-dev
https://golang.org/cl/824049
2010-04-13 13:28:08 -07:00
Russ Cox
00f9f0c056 single argument panic
note that sortmain.go has been run through hg gofmt;
only the formatting of the day initializers changed.
i'm happy to revert that formatting if you'd prefer.

stop on error in doc/progs/run

R=r
CC=golang-dev
https://golang.org/cl/850041
2010-03-30 10:34:57 -07:00
Andrew Gerrand
c10ccd567d template: fixed html formatter bug where it would turn a []byte
into a string of decimal numbers.

R=r, rsc
CC=golang-dev
https://golang.org/cl/624041
2010-03-19 09:46:39 +11:00
Andrew Gerrand
a2772a593b template: add ParseFile, MustParseFile, and associated tests
R=r
CC=golang-dev
https://golang.org/cl/391041
2010-03-10 20:19:20 +11:00
Robert Griesemer
f44fa9b4c7 gofmt: experiment: align values in map composites where possible
- gofmt -w src misc
- looking for feedback

R=rsc, r
CC=golang-dev
https://golang.org/cl/223076
2010-03-02 13:46:51 -08:00
Micah Stetson
8c5404746f Fix a couple of bugs referencing data values in template.
Adds tests and fixes for two cases that fail with the current release.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/217115
2010-02-26 18:39:43 +11:00
Russ Cox
9750adbbad strings: delete Runes, Bytes
gofmt -w -r 'strings.Bytes(a) -> []byte(a)' src/cmd src/pkg test/bench
gofmt -w -r 'strings.Runes(a) -> []int(a)' src/cmd src/pkg test/bench
delete unused imports

R=r
CC=golang-dev
https://golang.org/cl/224062
2010-02-25 16:01:29 -08:00
Robert Griesemer
1be05bbe1e gofmt: don't print ()'s around function-typed results (not needed anymore)
- add extra test cases to go/printer tests
- apply gofmt to src and misc

R=rsc
CC=golang-dev
https://golang.org/cl/223041
2010-02-24 13:24:37 -08:00
Rob Pike
d2fc5d68da Change type of Printf's args to ... interface{}
R=rsc
CC=golang-dev
https://golang.org/cl/197043
2010-02-02 10:53:37 +11:00
Russ Cox
08d3f5e271 template: look inside interface values
R=r
CC=golang-dev
https://golang.org/cl/186169
2010-01-15 13:49:31 -08:00
Rob Pike
f3e7ddc2fb Rewrite tokenizer to clean up and fix a bug with spaces before delimited block.
Fixes #501.

R=rsc
CC=golang-dev
https://golang.org/cl/181183
2010-01-08 17:49:55 +11:00
Rob Pike
96da3e96c3 implement .repeats for maps.
Fixes #309.

R=rsc
CC=golang-dev
https://golang.org/cl/181044
2009-12-24 07:41:56 +11:00
Rob Pike
42a2e95989 add the ability to invoke niladic single-valued methods in templates.
Fixes #389.

R=rsc
CC=golang-dev
https://golang.org/cl/180061
2009-12-16 03:10:50 -08:00
Robert Griesemer
45ca9f7a9e 1) Change default gofmt default settings for
parsing and printing to new syntax.

   Use -oldparser to parse the old syntax,
   use -oldprinter to print the old syntax.

2) Change default gofmt formatting settings
   to use tabs for indentation only and to use
   spaces for alignment. This will make the code
   alignment insensitive to an editor's tabwidth.

   Use -spaces=false to use tabs for alignment.

3) Manually changed src/exp/parser/parser_test.go
   so that it doesn't try to parse the parser's
   source files using the old syntax (they have
   new syntax now).

4) gofmt -w src misc test/bench

5th and last set of files.

R=rsc
CC=golang-dev
https://golang.org/cl/180050
2009-12-15 15:41:46 -08:00
Robert Griesemer
295ceb4526 remove uses of string concatenation from src and misc directory
R=rsc
https://golang.org/cl/172041
2009-12-09 16:54:07 -08:00
Russ Cox
ed62d27a52 template: two bug fixes / nits
* diagnose template not created with New
    (current code just crashes)
  * write []byte uninterpreted
    (current code writes fmt format: "[65 65 65 65]")

R=r
CC=golang-dev
https://golang.org/cl/161075
2009-11-30 10:29:14 -08:00
Robert Griesemer
001a8b11ff Change to container/vector interface:
- removed New(len int) in favor of new(Vector).Resize(len, cap)
- removed Init(len int) in favor of Resize(len, cap)
- runs all.bash

Fixes #294.

R=rsc, r, r1
https://golang.org/cl/157143
2009-11-24 13:43:18 -08:00
Sergio Luis O. B. Correia
6fc820729e go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.

this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.

Fixes #115.

R=rsc, dsymonds1
https://golang.org/cl/157067
2009-11-23 17:32:51 -08:00
Russ Cox
9ac4449cb2 gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg
R=r, gri
CC=golang-dev
https://golang.org/cl/156115
2009-11-20 11:45:05 -08:00
James Meneghello
bfbb31595b Map support for template.Execute().
Allows the developer to pass a map either by itself for
evaluation, or inside a struct. Access to data inside
maps is identical to the current system for structs, ie.

-Psuedocode-

mp map[string]string = {
	"header" : "A fantastic header!",
	"footer" : "A not-so-fantastic footer!",
}
template.Execute(mp)

...can be accessed using {header} and {footer} in
the template. Similarly, for maps inside structs:

type s struct {
	mp map[string]string,
}
s1 = new s
s1.mp["header"] = "A fantastic header!";
template.Execute(s1)

...is accessed using {mp.header}. Multi-maps, ie.
map[string](map[string]string) and maps of structs
containing more maps are unsupported, but then, I'm
not even sure if that's supported by the language.

Map elements can be of any type that can be written
by the formatters. Keys should really only be strings.

Fixes #259.

R=r, rsc
https://golang.org/cl/157088
2009-11-19 21:08:05 -08:00
Robert Griesemer
3bb0032cd6 - replaced gofmt expression formatting algorithm with
rsc's algorithm
- applied gofmt -w misc src
- partial CL (last chunk)

R=rsc, r
http://go/go-review/1024041
2009-11-09 21:23:52 -08:00
Robert Griesemer
40621d5c0d remove semis after statements in one-statement statement lists
R=rsc, r
http://go/go-review/1025029
2009-11-09 12:07:39 -08:00
Russ Cox
ed6eb5b577 a nagging inconsistency: capitalization of
HTML vs Html, URL vs Url, HTTP vs Http,
current source is 6:1 in favor of the former,
so change instances of the latter.

R=r
CC=go-dev
http://go/go-review/1024026
2009-11-08 21:46:20 -08:00
Robert Griesemer
368f8cbc75 - fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)

R=r, rsc
CC=go-dev
http://go/go-review/1026006
2009-11-06 14:24:38 -08:00
Robert Griesemer
8cd2e76404 - gofmt'ing of some stragglers, now with correct comment indentation
in special cases
- re-gofmt'ing of some files that are now improved

R=r, rsc
http://go/go-review/1023003
2009-11-05 17:02:55 -08:00
Robert Griesemer
b8d88a9913 gofmt-ify strings, template
R=r
http://go/go-review/1018064
2009-11-05 15:12:37 -08:00
Robert Griesemer
30c7088c95 gofmt-ify template, time, unsafe, flag, fmt
(replacement for CLs 1017039, 1017041, 1017040, 1018054)

R=r
http://go/go-review/1018060
2009-11-05 09:40:28 -08:00
Rob Pike
56cba8855e panic can't print interfaces well so use err.String()
R=rsc
http://go/go-review/1016041
2009-11-04 15:13:16 -08:00
Robert Griesemer
467c726eec add " and ' to list of html-escaped chars
R=rsc
http://go/go-review/1017025
2009-11-03 22:52:10 -08:00
Rob Pike
929e27e3d5 fix build
R=gri
http://go/go-review/1017014
2009-11-02 23:06:48 -08:00
Rob Pike
120d0b50c6 forgot to count newlines when scanning white space.
also fix a error-printing bug in godoc.

R=gri
http://go/go-review/1016030
2009-11-02 20:35:52 -08:00
Rob Pike
236a9de93f remove goroutines from template parsing.
fix up one usage to take advantage.

R=rsc
CC=go-dev
http://go/go-review/1018023
2009-11-02 13:09:31 -08:00
Russ Cox
d2829faa7c files that are okay from the last gofmt round
R=gri
http://go/go-review/1015011
2009-10-27 22:47:54 -07:00
Russ Cox
094f1d5990 more lgtm files from gofmt
R=gri
OCL=35485
CL=35488
2009-10-08 15:14:54 -07:00
Rob Pike
7be770071f use buf.String() instead of string(buf.Bytes())
use strings.Buffer instead of bytes.Buffer in some places

R=rsc
DELTA=40  (0 added, 3 deleted, 37 changed)
OCL=34770
CL=34775
2009-09-17 23:51:06 -07:00
Russ Cox
20011bc878 unused imports
R=r
OCL=34731
CL=34731
2009-09-17 10:27:04 -07:00