mirror of
https://github.com/golang/go
synced 2024-11-19 21:14:43 -07:00
std: add struct field tags to untagged literals.
R=rsc, dsymonds, bsiegert, rogpeppe CC=golang-dev https://golang.org/cl/5619052
This commit is contained in:
parent
e489ab8ecc
commit
102638cb53
@ -40,7 +40,7 @@ func ParsePKCS1PrivateKey(der []byte) (key *rsa.PrivateKey, err error) {
|
|||||||
var priv pkcs1PrivateKey
|
var priv pkcs1PrivateKey
|
||||||
rest, err := asn1.Unmarshal(der, &priv)
|
rest, err := asn1.Unmarshal(der, &priv)
|
||||||
if len(rest) > 0 {
|
if len(rest) > 0 {
|
||||||
err = asn1.SyntaxError{"trailing data"}
|
err = asn1.SyntaxError{Msg: "trailing data"}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -592,7 +592,7 @@ func parseCertificate(in *certificate) (*Certificate, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !seq.IsCompound || seq.Tag != 16 || seq.Class != 0 {
|
if !seq.IsCompound || seq.Tag != 16 || seq.Class != 0 {
|
||||||
return nil, asn1.StructuralError{"bad SAN sequence"}
|
return nil, asn1.StructuralError{Msg: "bad SAN sequence"}
|
||||||
}
|
}
|
||||||
|
|
||||||
parsedName := false
|
parsedName := false
|
||||||
@ -744,7 +744,7 @@ func ParseCertificate(asn1Data []byte) (*Certificate, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(rest) > 0 {
|
if len(rest) > 0 {
|
||||||
return nil, asn1.SyntaxError{"trailing data"}
|
return nil, asn1.SyntaxError{Msg: "trailing data"}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseCertificate(&cert)
|
return parseCertificate(&cert)
|
||||||
|
@ -586,25 +586,25 @@ func converterForType(typ string) driver.ValueConverter {
|
|||||||
case "bool":
|
case "bool":
|
||||||
return driver.Bool
|
return driver.Bool
|
||||||
case "nullbool":
|
case "nullbool":
|
||||||
return driver.Null{driver.Bool}
|
return driver.Null{Converter: driver.Bool}
|
||||||
case "int32":
|
case "int32":
|
||||||
return driver.Int32
|
return driver.Int32
|
||||||
case "string":
|
case "string":
|
||||||
return driver.NotNull{driver.String}
|
return driver.NotNull{Converter: driver.String}
|
||||||
case "nullstring":
|
case "nullstring":
|
||||||
return driver.Null{driver.String}
|
return driver.Null{Converter: driver.String}
|
||||||
case "int64":
|
case "int64":
|
||||||
// TODO(coopernurse): add type-specific converter
|
// TODO(coopernurse): add type-specific converter
|
||||||
return driver.NotNull{driver.DefaultParameterConverter}
|
return driver.NotNull{Converter: driver.DefaultParameterConverter}
|
||||||
case "nullint64":
|
case "nullint64":
|
||||||
// TODO(coopernurse): add type-specific converter
|
// TODO(coopernurse): add type-specific converter
|
||||||
return driver.Null{driver.DefaultParameterConverter}
|
return driver.Null{Converter: driver.DefaultParameterConverter}
|
||||||
case "float64":
|
case "float64":
|
||||||
// TODO(coopernurse): add type-specific converter
|
// TODO(coopernurse): add type-specific converter
|
||||||
return driver.NotNull{driver.DefaultParameterConverter}
|
return driver.NotNull{Converter: driver.DefaultParameterConverter}
|
||||||
case "nullfloat64":
|
case "nullfloat64":
|
||||||
// TODO(coopernurse): add type-specific converter
|
// TODO(coopernurse): add type-specific converter
|
||||||
return driver.Null{driver.DefaultParameterConverter}
|
return driver.Null{Converter: driver.DefaultParameterConverter}
|
||||||
case "datetime":
|
case "datetime":
|
||||||
return driver.DefaultParameterConverter
|
return driver.DefaultParameterConverter
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,11 @@ func (w *Watcher) AddWatch(path string, flags uint32) error {
|
|||||||
}
|
}
|
||||||
wd, err := syscall.InotifyAddWatch(w.fd, path, flags)
|
wd, err := syscall.InotifyAddWatch(w.fd, path, flags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &os.PathError{"inotify_add_watch", path, err}
|
return &os.PathError{
|
||||||
|
Op: "inotify_add_watch",
|
||||||
|
Path: path,
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
|
@ -33,8 +33,11 @@ func Examples(pkg *ast.Package) []*Example {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
examples = append(examples, &Example{
|
examples = append(examples, &Example{
|
||||||
Name: name[len("Example"):],
|
Name: name[len("Example"):],
|
||||||
Body: &printer.CommentedNode{f.Body, src.Comments},
|
Body: &printer.CommentedNode{
|
||||||
|
Node: f.Body,
|
||||||
|
Comments: src.Comments,
|
||||||
|
},
|
||||||
Output: f.Doc.Text(),
|
Output: f.Doc.Text(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,13 @@ func TestScan(t *testing.T) {
|
|||||||
var s Scanner
|
var s Scanner
|
||||||
s.Init(fset.AddFile("", fset.Base(), len(source)), source, &testErrorHandler{t}, ScanComments|dontInsertSemis)
|
s.Init(fset.AddFile("", fset.Base(), len(source)), source, &testErrorHandler{t}, ScanComments|dontInsertSemis)
|
||||||
index := 0
|
index := 0
|
||||||
epos := token.Position{"", 0, 1, 1} // expected position
|
// epos is the expected position
|
||||||
|
epos := token.Position{
|
||||||
|
Filename: "",
|
||||||
|
Offset: 0,
|
||||||
|
Line: 1,
|
||||||
|
Column: 1,
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
pos, tok, lit := s.Scan()
|
pos, tok, lit := s.Scan()
|
||||||
if lit == "" {
|
if lit == "" {
|
||||||
@ -505,7 +511,12 @@ func TestLineComments(t *testing.T) {
|
|||||||
for _, s := range segs {
|
for _, s := range segs {
|
||||||
p, _, lit := S.Scan()
|
p, _, lit := S.Scan()
|
||||||
pos := file.Position(p)
|
pos := file.Position(p)
|
||||||
checkPos(t, lit, p, token.Position{s.filename, pos.Offset, s.line, pos.Column})
|
checkPos(t, lit, p, token.Position{
|
||||||
|
Filename: s.filename,
|
||||||
|
Offset: pos.Offset,
|
||||||
|
Line: s.line,
|
||||||
|
Column: pos.Column,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if S.ErrorCount != 0 {
|
if S.ErrorCount != 0 {
|
||||||
|
@ -1471,7 +1471,7 @@ func TestEscapeText(t *testing.T) {
|
|||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
b, e := []byte(test.input), newEscaper(nil)
|
b, e := []byte(test.input), newEscaper(nil)
|
||||||
c := e.escapeText(context{}, &parse.TextNode{parse.NodeText, b})
|
c := e.escapeText(context{}, &parse.TextNode{NodeType: parse.NodeText, Text: b})
|
||||||
if !test.output.eq(c) {
|
if !test.output.eq(c) {
|
||||||
t.Errorf("input %q: want context\n\t%v\ngot\n\t%v", test.input, test.output, c)
|
t.Errorf("input %q: want context\n\t%v\ngot\n\t%v", test.input, test.output, c)
|
||||||
continue
|
continue
|
||||||
|
@ -56,7 +56,7 @@ func bench(b *testing.B, dcm, scm, mcm color.Model, op Op) {
|
|||||||
var src image.Image
|
var src image.Image
|
||||||
switch scm {
|
switch scm {
|
||||||
case nil:
|
case nil:
|
||||||
src = &image.Uniform{color.RGBA{0x11, 0x22, 0x33, 0xff}}
|
src = &image.Uniform{C: color.RGBA{0x11, 0x22, 0x33, 0xff}}
|
||||||
case color.RGBAModel:
|
case color.RGBAModel:
|
||||||
src1 := image.NewRGBA(image.Rect(0, 0, srcw, srch))
|
src1 := image.NewRGBA(image.Rect(0, 0, srcw, srch))
|
||||||
for y := 0; y < srch; y++ {
|
for y := 0; y < srch; y++ {
|
||||||
@ -145,7 +145,7 @@ func bench(b *testing.B, dcm, scm, mcm color.Model, op Op) {
|
|||||||
x := 3 * i % (dstw - srcw)
|
x := 3 * i % (dstw - srcw)
|
||||||
y := 7 * i % (dsth - srch)
|
y := 7 * i % (dsth - srch)
|
||||||
|
|
||||||
DrawMask(dst, dst.Bounds().Add(image.Point{x, y}), src, image.ZP, mask, image.ZP, op)
|
DrawMask(dst, dst.Bounds().Add(image.Pt(x, y)), src, image.ZP, mask, image.ZP, op)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,15 +168,15 @@ func makeGolden(dst image.Image, r image.Rectangle, src image.Image, sp image.Po
|
|||||||
sy := y + sp.Y - r.Min.Y
|
sy := y + sp.Y - r.Min.Y
|
||||||
my := y + mp.Y - r.Min.Y
|
my := y + mp.Y - r.Min.Y
|
||||||
for x := r.Min.X; x < r.Max.X; x++ {
|
for x := r.Min.X; x < r.Max.X; x++ {
|
||||||
if !(image.Point{x, y}.In(b)) {
|
if !(image.Pt(x, y).In(b)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
sx := x + sp.X - r.Min.X
|
sx := x + sp.X - r.Min.X
|
||||||
if !(image.Point{sx, sy}.In(sb)) {
|
if !(image.Pt(sx, sy).In(sb)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
mx := x + mp.X - r.Min.X
|
mx := x + mp.X - r.Min.X
|
||||||
if !(image.Point{mx, my}.In(mb)) {
|
if !(image.Pt(mx, my).In(mb)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ func TestFill(t *testing.T) {
|
|||||||
m := image.NewRGBA(image.Rect(0, 0, 40, 30)).SubImage(r).(*image.RGBA)
|
m := image.NewRGBA(image.Rect(0, 0, 40, 30)).SubImage(r).(*image.RGBA)
|
||||||
b := m.Bounds()
|
b := m.Bounds()
|
||||||
c := color.RGBA{11, 0, 0, 255}
|
c := color.RGBA{11, 0, 0, 255}
|
||||||
src := &image.Uniform{c}
|
src := &image.Uniform{C: c}
|
||||||
check := func(desc string) {
|
check := func(desc string) {
|
||||||
for y := b.Min.Y; y < b.Max.Y; y++ {
|
for y := b.Min.Y; y < b.Max.Y; y++ {
|
||||||
for x := b.Min.X; x < b.Max.X; x++ {
|
for x := b.Min.X; x < b.Max.X; x++ {
|
||||||
@ -333,21 +333,21 @@ func TestFill(t *testing.T) {
|
|||||||
check("pixel")
|
check("pixel")
|
||||||
// Draw 1 row at a time.
|
// Draw 1 row at a time.
|
||||||
c = color.RGBA{0, 22, 0, 255}
|
c = color.RGBA{0, 22, 0, 255}
|
||||||
src = &image.Uniform{c}
|
src = &image.Uniform{C: c}
|
||||||
for y := b.Min.Y; y < b.Max.Y; y++ {
|
for y := b.Min.Y; y < b.Max.Y; y++ {
|
||||||
DrawMask(m, image.Rect(b.Min.X, y, b.Max.X, y+1), src, image.ZP, nil, image.ZP, Src)
|
DrawMask(m, image.Rect(b.Min.X, y, b.Max.X, y+1), src, image.ZP, nil, image.ZP, Src)
|
||||||
}
|
}
|
||||||
check("row")
|
check("row")
|
||||||
// Draw 1 column at a time.
|
// Draw 1 column at a time.
|
||||||
c = color.RGBA{0, 0, 33, 255}
|
c = color.RGBA{0, 0, 33, 255}
|
||||||
src = &image.Uniform{c}
|
src = &image.Uniform{C: c}
|
||||||
for x := b.Min.X; x < b.Max.X; x++ {
|
for x := b.Min.X; x < b.Max.X; x++ {
|
||||||
DrawMask(m, image.Rect(x, b.Min.Y, x+1, b.Max.Y), src, image.ZP, nil, image.ZP, Src)
|
DrawMask(m, image.Rect(x, b.Min.Y, x+1, b.Max.Y), src, image.ZP, nil, image.ZP, Src)
|
||||||
}
|
}
|
||||||
check("column")
|
check("column")
|
||||||
// Draw the whole image at once.
|
// Draw the whole image at once.
|
||||||
c = color.RGBA{44, 55, 66, 77}
|
c = color.RGBA{44, 55, 66, 77}
|
||||||
src = &image.Uniform{c}
|
src = &image.Uniform{C: c}
|
||||||
DrawMask(m, b, src, image.ZP, nil, image.ZP, Src)
|
DrawMask(m, b, src, image.ZP, nil, image.ZP, Src)
|
||||||
check("whole")
|
check("whole")
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,11 @@ func DecodeConfig(r io.Reader) (image.Config, error) {
|
|||||||
if err := d.decode(r, true); err != nil {
|
if err := d.decode(r, true); err != nil {
|
||||||
return image.Config{}, err
|
return image.Config{}, err
|
||||||
}
|
}
|
||||||
return image.Config{d.globalColorMap, d.width, d.height}, nil
|
return image.Config{
|
||||||
|
ColorModel: d.globalColorMap,
|
||||||
|
Width: d.width,
|
||||||
|
Height: d.height,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -454,9 +454,17 @@ func DecodeConfig(r io.Reader) (image.Config, error) {
|
|||||||
}
|
}
|
||||||
switch d.nComp {
|
switch d.nComp {
|
||||||
case nGrayComponent:
|
case nGrayComponent:
|
||||||
return image.Config{color.GrayModel, d.width, d.height}, nil
|
return image.Config{
|
||||||
|
ColorModel: color.GrayModel,
|
||||||
|
Width: d.width,
|
||||||
|
Height: d.height,
|
||||||
|
}, nil
|
||||||
case nColorComponent:
|
case nColorComponent:
|
||||||
return image.Config{color.YCbCrModel, d.width, d.height}, nil
|
return image.Config{
|
||||||
|
ColorModel: color.YCbCrModel,
|
||||||
|
Width: d.width,
|
||||||
|
Height: d.height,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
return image.Config{}, FormatError("missing SOF marker")
|
return image.Config{}, FormatError("missing SOF marker")
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ func (e *encoder) writeSOS(m image.Image) {
|
|||||||
for i := 0; i < 4; i++ {
|
for i := 0; i < 4; i++ {
|
||||||
xOff := (i & 1) * 8
|
xOff := (i & 1) * 8
|
||||||
yOff := (i & 2) * 4
|
yOff := (i & 2) * 4
|
||||||
p := image.Point{x + xOff, y + yOff}
|
p := image.Pt(x+xOff, y+yOff)
|
||||||
if rgba != nil {
|
if rgba != nil {
|
||||||
rgbaToYCbCr(rgba, p, &yBlock, &cbBlock[i], &crBlock[i])
|
rgbaToYCbCr(rgba, p, &yBlock, &cbBlock[i], &crBlock[i])
|
||||||
} else {
|
} else {
|
||||||
|
@ -690,7 +690,11 @@ func DecodeConfig(r io.Reader) (image.Config, error) {
|
|||||||
case cbTCA16:
|
case cbTCA16:
|
||||||
cm = color.NRGBA64Model
|
cm = color.NRGBA64Model
|
||||||
}
|
}
|
||||||
return image.Config{cm, d.width, d.height}, nil
|
return image.Config{
|
||||||
|
ColorModel: cm,
|
||||||
|
Width: d.width,
|
||||||
|
Height: d.height,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -245,7 +245,11 @@ func (c *Client) doFollowingRedirects(ireq *Request) (r *Response, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
method := ireq.Method
|
method := ireq.Method
|
||||||
err = &url.Error{method[0:1] + strings.ToLower(method[1:]), urlStr, err}
|
err = &url.Error{
|
||||||
|
Op: method[0:1] + strings.ToLower(method[1:]),
|
||||||
|
URL: urlStr,
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrPersistEOF = &http.ProtocolError{"persistent connection closed"}
|
ErrPersistEOF = &http.ProtocolError{ErrorString: "persistent connection closed"}
|
||||||
ErrPipeline = &http.ProtocolError{"pipeline error"}
|
ErrPipeline = &http.ProtocolError{ErrorString: "pipeline error"}
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is an API usage error - the local side is closed.
|
// This is an API usage error - the local side is closed.
|
||||||
|
@ -36,7 +36,11 @@ func newPollServer() (s *pollServer, err error) {
|
|||||||
return s, nil
|
return s, nil
|
||||||
|
|
||||||
Errno:
|
Errno:
|
||||||
err = &os.PathError{"setnonblock", s.pr.Name(), err}
|
err = &os.PathError{
|
||||||
|
Op: "setnonblock",
|
||||||
|
Path: s.pr.Name(),
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
Error:
|
Error:
|
||||||
s.pr.Close()
|
s.pr.Close()
|
||||||
s.pw.Close()
|
s.pw.Close()
|
||||||
|
@ -232,7 +232,12 @@ func DialHTTPPath(network, address, path string) (*Client, error) {
|
|||||||
err = errors.New("unexpected HTTP response: " + resp.Status)
|
err = errors.New("unexpected HTTP response: " + resp.Status)
|
||||||
}
|
}
|
||||||
conn.Close()
|
conn.Close()
|
||||||
return nil, &net.OpError{"dial-http", network + " " + address, nil, err}
|
return nil, &net.OpError{
|
||||||
|
Op: "dial-http",
|
||||||
|
Net: network + " " + address,
|
||||||
|
Addr: nil,
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dial connects to an RPC server at the specified network address.
|
// Dial connects to an RPC server at the specified network address.
|
||||||
|
@ -155,7 +155,7 @@ func (c *Client) Auth(a Auth) error {
|
|||||||
// the last message isn't base64 because it isn't a challenge
|
// the last message isn't base64 because it isn't a challenge
|
||||||
msg = []byte(msg64)
|
msg = []byte(msg64)
|
||||||
default:
|
default:
|
||||||
err = &textproto.Error{code, msg64}
|
err = &textproto.Error{Code: code, Msg: msg64}
|
||||||
}
|
}
|
||||||
resp, err = a.Next(msg, code == 334)
|
resp, err = a.Next(msg, code == 334)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -29,7 +29,7 @@ func (p *Process) Wait(options int) (w *Waitmsg, err error) {
|
|||||||
return nil, NewSyscallError("GetExitCodeProcess", e)
|
return nil, NewSyscallError("GetExitCodeProcess", e)
|
||||||
}
|
}
|
||||||
p.done = true
|
p.done = true
|
||||||
return &Waitmsg{p.Pid, syscall.WaitStatus{s, ec}, new(syscall.Rusage)}, nil
|
return &Waitmsg{p.Pid, syscall.WaitStatus{Status: s, ExitCode: ec}, new(syscall.Rusage)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal sends a signal to the Process.
|
// Signal sends a signal to the Process.
|
||||||
|
@ -1377,8 +1377,8 @@ func (p *parser) appendGroup(r []rune, g charGroup) []rune {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var anyTable = &unicode.RangeTable{
|
var anyTable = &unicode.RangeTable{
|
||||||
[]unicode.Range16{{0, 1<<16 - 1, 1}},
|
R16: []unicode.Range16{{Lo: 0, Hi: 1<<16 - 1, Stride: 1}},
|
||||||
[]unicode.Range32{{1 << 16, unicode.MaxRune, 1}},
|
R32: []unicode.Range32{{Lo: 1 << 16, Hi: unicode.MaxRune, Stride: 1}},
|
||||||
}
|
}
|
||||||
|
|
||||||
// unicodeTable returns the unicode.RangeTable identified by name
|
// unicodeTable returns the unicode.RangeTable identified by name
|
||||||
|
@ -652,7 +652,11 @@ func foldAdjacent(r []Script) []unicode.Range32 {
|
|||||||
s[j-1].Hi = r[i].hi
|
s[j-1].Hi = r[i].hi
|
||||||
} else {
|
} else {
|
||||||
s = s[0 : j+1]
|
s = s[0 : j+1]
|
||||||
s[j] = unicode.Range32{uint32(r[i].lo), uint32(r[i].hi), 1}
|
s[j] = unicode.Range32{
|
||||||
|
Lo: uint32(r[i].lo),
|
||||||
|
Hi: uint32(r[i].hi),
|
||||||
|
Stride: 1,
|
||||||
|
}
|
||||||
j++
|
j++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user