Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
434a6c85
Commit
434a6c85
authored
Dec 02, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: use gofmt spacing when printing map type
R=ken2 CC=golang-dev
https://golang.org/cl/5450071
parent
dcf1d7bc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
14 deletions
+14
-14
fmt.c
src/cmd/gc/fmt.c
+2
-2
marshal_test.go
src/pkg/encoding/xml/marshal_test.go
+2
-2
fmt_test.go
src/pkg/fmt/fmt_test.go
+4
-4
print_test.go
src/pkg/go/ast/print_test.go
+1
-1
all_test.go
src/pkg/reflect/all_test.go
+3
-3
escape2.go
test/escape2.go
+2
-2
No files found.
src/cmd/gc/fmt.c
View file @
434a6c85
...
@@ -610,7 +610,7 @@ typefmt(Fmt *fp, Type *t)
...
@@ -610,7 +610,7 @@ typefmt(Fmt *fp, Type *t)
return
fmtprint
(
fp
,
"chan %T"
,
t
->
type
);
return
fmtprint
(
fp
,
"chan %T"
,
t
->
type
);
case
TMAP
:
case
TMAP
:
return
fmtprint
(
fp
,
"map[%T]
%T"
,
t
->
down
,
t
->
type
);
return
fmtprint
(
fp
,
"map[%T]%T"
,
t
->
down
,
t
->
type
);
case
TINTER
:
case
TINTER
:
fmtstrcpy
(
fp
,
"interface {"
);
fmtstrcpy
(
fp
,
"interface {"
);
...
@@ -1067,7 +1067,7 @@ exprfmt(Fmt *f, Node *n, int prec)
...
@@ -1067,7 +1067,7 @@ exprfmt(Fmt *f, Node *n, int prec)
return
fmtprint
(
f
,
"(%N)"
,
n
->
left
);
return
fmtprint
(
f
,
"(%N)"
,
n
->
left
);
case
OTMAP
:
case
OTMAP
:
return
fmtprint
(
f
,
"map[%N]
%N"
,
n
->
left
,
n
->
right
);
return
fmtprint
(
f
,
"map[%N]%N"
,
n
->
left
,
n
->
right
);
case
OTCHAN
:
case
OTCHAN
:
switch
(
n
->
etype
)
{
switch
(
n
->
etype
)
{
...
...
src/pkg/encoding/xml/marshal_test.go
View file @
434a6c85
...
@@ -326,12 +326,12 @@ var marshalErrorTests = []struct {
...
@@ -326,12 +326,12 @@ var marshalErrorTests = []struct {
"question"
:
"What do you get when you multiply six by nine?"
,
"question"
:
"What do you get when you multiply six by nine?"
,
"answer"
:
"42"
,
"answer"
:
"42"
,
},
},
Err
:
"xml: unsupported type: map[string]
string"
,
Err
:
"xml: unsupported type: map[string]string"
,
Kind
:
reflect
.
Map
,
Kind
:
reflect
.
Map
,
},
},
{
{
Value
:
map
[
*
Ship
]
bool
{
nil
:
false
},
Value
:
map
[
*
Ship
]
bool
{
nil
:
false
},
Err
:
"xml: unsupported type: map[*xml.Ship]
bool"
,
Err
:
"xml: unsupported type: map[*xml.Ship]bool"
,
Kind
:
reflect
.
Map
,
Kind
:
reflect
.
Map
,
},
},
}
}
...
...
src/pkg/fmt/fmt_test.go
View file @
434a6c85
...
@@ -361,8 +361,8 @@ var fmttests = []struct {
...
@@ -361,8 +361,8 @@ var fmttests = []struct {
{
"%#v"
,
make
(
chan
int
),
"(chan int)(0xPTR)"
},
{
"%#v"
,
make
(
chan
int
),
"(chan int)(0xPTR)"
},
{
"%#v"
,
uint64
(
1
<<
64
-
1
),
"0xffffffffffffffff"
},
{
"%#v"
,
uint64
(
1
<<
64
-
1
),
"0xffffffffffffffff"
},
{
"%#v"
,
1000000000
,
"1000000000"
},
{
"%#v"
,
1000000000
,
"1000000000"
},
{
"%#v"
,
map
[
string
]
int
{
"a"
:
1
},
`map[string]
int{"a":1}`
},
{
"%#v"
,
map
[
string
]
int
{
"a"
:
1
},
`map[string]int{"a":1}`
},
{
"%#v"
,
map
[
string
]
B
{
"a"
:
{
1
,
2
}},
`map[string]
fmt_test.B{"a":fmt_test.B{I:1, j:2}}`
},
{
"%#v"
,
map
[
string
]
B
{
"a"
:
{
1
,
2
}},
`map[string]fmt_test.B{"a":fmt_test.B{I:1, j:2}}`
},
{
"%#v"
,
[]
string
{
"a"
,
"b"
},
`[]string{"a", "b"}`
},
{
"%#v"
,
[]
string
{
"a"
,
"b"
},
`[]string{"a", "b"}`
},
{
"%#v"
,
SI
{},
`fmt_test.SI{I:interface {}(nil)}`
},
{
"%#v"
,
SI
{},
`fmt_test.SI{I:interface {}(nil)}`
},
{
"%#v"
,
[]
int
(
nil
),
`[]int(nil)`
},
{
"%#v"
,
[]
int
(
nil
),
`[]int(nil)`
},
...
@@ -371,8 +371,8 @@ var fmttests = []struct {
...
@@ -371,8 +371,8 @@ var fmttests = []struct {
{
"%#v"
,
&
array
,
`&[5]int{1, 2, 3, 4, 5}`
},
{
"%#v"
,
&
array
,
`&[5]int{1, 2, 3, 4, 5}`
},
{
"%#v"
,
iarray
,
`[4]interface {}{1, "hello", 2.5, interface {}(nil)}`
},
{
"%#v"
,
iarray
,
`[4]interface {}{1, "hello", 2.5, interface {}(nil)}`
},
{
"%#v"
,
&
iarray
,
`&[4]interface {}{1, "hello", 2.5, interface {}(nil)}`
},
{
"%#v"
,
&
iarray
,
`&[4]interface {}{1, "hello", 2.5, interface {}(nil)}`
},
{
"%#v"
,
map
[
int
]
byte
(
nil
),
`map[int]
uint8(nil)`
},
{
"%#v"
,
map
[
int
]
byte
(
nil
),
`map[int]uint8(nil)`
},
{
"%#v"
,
map
[
int
]
byte
{},
`map[int]
uint8{}`
},
{
"%#v"
,
map
[
int
]
byte
{},
`map[int]uint8{}`
},
// slices with other formats
// slices with other formats
{
"%#x"
,
[]
int
{
1
,
2
,
15
},
`[0x1 0x2 0xf]`
},
{
"%#x"
,
[]
int
{
1
,
2
,
15
},
`[0x1 0x2 0xf]`
},
...
...
src/pkg/go/ast/print_test.go
View file @
434a6c85
...
@@ -24,7 +24,7 @@ var tests = []struct {
...
@@ -24,7 +24,7 @@ var tests = []struct {
// maps
// maps
{
map
[
string
]
int
{
"a"
:
1
},
{
map
[
string
]
int
{
"a"
:
1
},
`0 map[string]
int (len = 1) {
`0 map[string]int (len = 1) {
1 . "a": 1
1 . "a": 1
2 }`
},
2 }`
},
...
...
src/pkg/reflect/all_test.go
View file @
434a6c85
...
@@ -64,7 +64,7 @@ var typeTests = []pair{
...
@@ -64,7 +64,7 @@ var typeTests = []pair{
{
struct
{
x
(
**
integer
)
}{},
"**reflect_test.integer"
},
{
struct
{
x
(
**
integer
)
}{},
"**reflect_test.integer"
},
{
struct
{
x
([
32
]
int32
)
}{},
"[32]int32"
},
{
struct
{
x
([
32
]
int32
)
}{},
"[32]int32"
},
{
struct
{
x
([]
int8
)
}{},
"[]int8"
},
{
struct
{
x
([]
int8
)
}{},
"[]int8"
},
{
struct
{
x
(
map
[
string
]
int32
)
}{},
"map[string]
int32"
},
{
struct
{
x
(
map
[
string
]
int32
)
}{},
"map[string]int32"
},
{
struct
{
x
(
chan
<-
string
)
}{},
"chan<- string"
},
{
struct
{
x
(
chan
<-
string
)
}{},
"chan<- string"
},
{
struct
{
{
struct
{
x
struct
{
x
struct
{
...
@@ -180,7 +180,7 @@ var valueTests = []pair{
...
@@ -180,7 +180,7 @@ var valueTests = []pair{
{
new
(
**
int8
),
"**int8(0)"
},
{
new
(
**
int8
),
"**int8(0)"
},
{
new
([
5
]
int32
),
"[5]int32{0, 0, 0, 0, 0}"
},
{
new
([
5
]
int32
),
"[5]int32{0, 0, 0, 0, 0}"
},
{
new
(
**
integer
),
"**reflect_test.integer(0)"
},
{
new
(
**
integer
),
"**reflect_test.integer(0)"
},
{
new
(
map
[
string
]
int32
),
"map[string]
int32{<can't iterate on maps>}"
},
{
new
(
map
[
string
]
int32
),
"map[string]int32{<can't iterate on maps>}"
},
{
new
(
chan
<-
string
),
"chan<- string"
},
{
new
(
chan
<-
string
),
"chan<- string"
},
{
new
(
func
(
a
int8
,
b
int32
)),
"func(int8, int32)(0)"
},
{
new
(
func
(
a
int8
,
b
int32
)),
"func(int8, int32)(0)"
},
{
new
(
struct
{
{
new
(
struct
{
...
@@ -419,7 +419,7 @@ func TestAll(t *testing.T) {
...
@@ -419,7 +419,7 @@ func TestAll(t *testing.T) {
testType
(
t
,
8
,
typ
.
Elem
(),
"int32"
)
testType
(
t
,
8
,
typ
.
Elem
(),
"int32"
)
typ
=
TypeOf
((
map
[
string
]
*
int32
)(
nil
))
typ
=
TypeOf
((
map
[
string
]
*
int32
)(
nil
))
testType
(
t
,
9
,
typ
,
"map[string]
*int32"
)
testType
(
t
,
9
,
typ
,
"map[string]*int32"
)
mtyp
:=
typ
mtyp
:=
typ
testType
(
t
,
10
,
mtyp
.
Key
(),
"string"
)
testType
(
t
,
10
,
mtyp
.
Key
(),
"string"
)
testType
(
t
,
11
,
mtyp
.
Elem
(),
"*int32"
)
testType
(
t
,
11
,
mtyp
.
Elem
(),
"*int32"
)
...
...
test/escape2.go
View file @
434a6c85
...
@@ -614,11 +614,11 @@ func LimitFooer(r Fooer, n int64) Fooer { // ERROR "leaking param: r"
...
@@ -614,11 +614,11 @@ func LimitFooer(r Fooer, n int64) Fooer { // ERROR "leaking param: r"
}
}
func
foo90
(
x
*
int
)
map
[
*
int
]
*
int
{
// ERROR "leaking param: x"
func
foo90
(
x
*
int
)
map
[
*
int
]
*
int
{
// ERROR "leaking param: x"
return
map
[
*
int
]
*
int
{
nil
:
x
}
// ERROR "map\[\*int\]
\*int literal escapes to heap"
return
map
[
*
int
]
*
int
{
nil
:
x
}
// ERROR "map\[\*int\]\*int literal escapes to heap"
}
}
func
foo91
(
x
*
int
)
map
[
*
int
]
*
int
{
// ERROR "leaking param: x"
func
foo91
(
x
*
int
)
map
[
*
int
]
*
int
{
// ERROR "leaking param: x"
return
map
[
*
int
]
*
int
{
x
:
nil
}
// ERROR "map\[\*int\]
\*int literal escapes to heap"
return
map
[
*
int
]
*
int
{
x
:
nil
}
// ERROR "map\[\*int\]\*int literal escapes to heap"
}
}
func
foo92
(
x
*
int
)
[
2
]
*
int
{
// ERROR "leaking param: x"
func
foo92
(
x
*
int
)
[
2
]
*
int
{
// ERROR "leaking param: x"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment