weekly.2012-01-15

449 views
Skip to first unread message

Andrew Gerrand

unread,
Jan 15, 2012, 6:11:47 PM1/15/12
to golang-nuts
Happy New Year!

We've just tagged a new Go weekly, weekly.2012-01-15.

As usual, you can update by running:
hg pull
hg update weekly

This weekly snapshot includes two package changes that may require changes to
client code.

The image package's Tiled type has been renamed to Repeated.

The encoding/xml package has been changed to make more idiomatic use of struct
tags, among other things. If you use the xml package please read the change
description to see if your code is affected:
http://code.google.com/p/go/source/detail?r=70e914beb409

Function inlining is now enabled by default in the gc compiler.

Other changes:
* bytes: Buffer read of 0 bytes at EOF shouldn't be an EOF.
* cgo: if value for constant did not parse, get it from DWARF info,
write _cgo_export.h to object directory, not source dir.
* cmd/go: add -p flag for parallelism (like make -j),
add -v flag to build and install,
add ... patterns in import path arguments,
fix data race during build,
fix import directory list for compilation,
fix linker arguments,
handle cgo pkg-config pragmas,
handle path to cmd directory,
include test files in fmt, vet, and fix (thanks Sanjay Menakuru),
kill test processes after 10 minutes,
pass arguments to command for run (thanks Eric Eisner),
rely on exit code to tell if test passed,
use relative paths in go fix, go fmt, go vet output.
* cmd/gofmt: fix simplify.go by running gofmt on cmd/gofmt (thanks
Olivier Duperray).
* crypto/openpgp: assorted cleanups,
truncate hashes before checking DSA signatures.
* crypto/tls: improve TLS Client Authentication (thanks Jeff R. Allen),
update generate_cert.go for new time package.
* dashboard: better caching, bug fixes.
* doc: update "How to Write Go Code" to use the go tool.
fix broken function codewalk examples.
* encoding/asn1: document support for *big.Int (thanks Florian Weimer).
* encoding/gob: fix panic when decoding []byte to incompatible slice
types (thanks Alexey Borzenkov).
* encoding/json: don't marshal special float values (thanks Evan Shaw).
* encoding/xml: major Go 1 fixup (thanks Gustavo Niemeyer).
* exp/proxy: new package.
* exp/sql: add time.Time support,
close Rows on EOF,
fix potential corruption in QueryRow.Scan into a *[]byte.
* exp/ssh: various small fixes (thanks Dave Cheney).
* exp/terminal: add SetPrompt and handle large pastes,
add to level Makefile for the (non-Linux?) systems that need it.
* flag: add Duration flag type,
change Set method Value interface to return error instead of bool.
* gc: better errors messages,
avoid false positives when using scalar struct fields (thanks Rémy Oudompheng),
closure code gen improvements,
disallow declaration of variables outside package,
fix switch on interface values (thanks Rémy Oudompheng),
inlining bug fixes,
improve unsafe.Pointer type-check error messages (thanks Ryan Hitchman),
put limit on size of exported recursive interface (thanks Lorenzo Stoakes),
* go-mode.el: fix syntax highlighting of backticks (thanks Florian Weimer).
* go/ast: remove unnecessary result value from ast.Fprint/Print.
* go/build: allow colon in #cgo flags,
pass CgoLDFLAGS at end of link command.
* go/doc: new API, don't ignore anonymous non-exported fields, initial
testing support.
* go/parser: remove unused Parse* functions. Simplified ParseExpr signature.
* go/printer: don't crash if AST contains BadXXX nodes.
* go/scanner: 17% faster scanning, remove InsertSemis mode.
* goinstall: use correct checkout URL for Google Code svn repos.
* gotest: make _testmain.go conform to gofmt rules (thanks Benny Siegert).
* goyacc: fix units.y build breakage (thanks Shenghou Ma).
* html/template: reenable testcases and fix mis-escaped sequences
(thanks Mike Samuel).
* html: "in select in table" insertion mode (thanks Andrew Balholm),
adjust foreign attributes,
foreign element HTML integration points, tag name adjustment,
parse inside body (thanks Andrew Balholm),
propagate foreign namespaces only when adding foreign content.
* json: better error messages when the ,string option is misused.
* ld: parse but do not implement -X flag.
* log/syslog: add Alert method (thanks Vadim Vygonets).
* make.bash: remove old dregs (thanks Alex Brainman).
* math/big: simplify fast string conversion.
* math: fix typo in all_test.go (thanks Charles L. Dorian).
* misc/windows: add src/pkg/runtime/z* files to installation script
(thanks Alex Brainman).
* net/http: don't ignore Request.Write's Flush error,
allow cookies with negative Max-Age attribute as these are (thanks
Volker Dobler).
* net/textproto: avoid corruption when reading a single header.
* net: add IP-level socket option helpers for Unix variants (thanks Mikio Hara),
fix incorrect mode on ListenIP, ListenUDP (thanks Mikio Hara),
make use of the kernel state to listen on TCP, Unix (thanks Mikio Hara),
platform-dependent default socket options (thanks Mikio Hara).
* os: add ModeCharDevice.
* runtime: add NumCPU,
delete duplicate implementation of pcln walker,
distinct panic message for call of nil func value,
enable runtime.ncpu on FreeBSD (thanks Devon H. O'Dell),
make garbage collector faster by deleting code,
regenerate defs_darwin_{386,amd64}.h (thanks Dave Cheney),
runtime.usleep() bugfix on darwin/amd64 and linux/arm (thanks Shenghou Ma).
* spec: pointer comparison for pointers to 0-sized variables,
change the wording regarding select statement choice.
* strconv: fix round up corner case,
faster FormatFloat(x, *, -1, 64) using Grisu3 algorithm (thanks Rémy
Oudompheng),
implement fast path for rounding already short numbers (thanks Rémy
Oudompheng),
return ErrSyntax when unquoting illegal octal sequences.
* syscall: linux-only support for parent death signal (thanks Albert Strasheim),
make Environ return original order.
* testing: fix defer race,
use flag.Duration for -timeout flag.
* text/template: handle panic values that are not errors (thanks Rémy
Oudompheng),
for range on a map, sort the keys if feasible.
* time: add ParseDuration,
fix docs for After and NewTicker.
* windows: use ArbitraryUserPointer as TLS slot (thanks Wei Guangjing).

Apologies if we missed anyone in the list above. We appreciate all your help.

To see a full list of changes between this and the previous weekly,
after updating, run:
hg log -r weekly.2011-12-22:weekly.2012-01-15

Enjoy.

Andrew

dlin

unread,
Jan 15, 2012, 9:13:52 PM1/15/12
to golan...@googlegroups.com
When will stable version update?  Will it directly become version 1.
I found there are many code required to gofix between r60.3 and weekly build.

kortschak

unread,
Jan 15, 2012, 9:16:30 PM1/15/12
to golang-nuts
This weekly seems to have introduced a problem in godoc. Method titles
are rendered as:

func () Method

rather than:

func (Type) Method

e.g. from bytes:
func () Bytes

func (b *Buffer) Bytes() []byte

Bytes returns a ...

This appears on my build, but not on weekly.golang.org, so has anyone
else seen this problem before I submit a bug?

thanks

David Symonds

unread,
Jan 15, 2012, 9:18:28 PM1/15/12
to kortschak, golang-nuts
On Mon, Jan 16, 2012 at 1:16 PM, kortschak
<dan.ko...@adelaide.edu.au> wrote:

> This appears on my build, but not on weekly.golang.org, so has anyone
> else seen this problem before I submit a bug?

It works fine for me. Are you sure you don't have an old godoc binary
or old template files hanging around?


Dave.

Andrew Gerrand

unread,
Jan 15, 2012, 9:19:31 PM1/15/12
to golan...@googlegroups.com
On 16 January 2012 13:13, dlin <dli...@gmail.com> wrote:
> When will stable version update?  Will it directly become version 1.

Yes. The next stable version will be Go 1, although the current weekly
is very close to what Go 1 will be.

> I found there are many code required to gofix between r60.3 and weekly
> build.

Yes, there are many changes. But after Go 1 you won't need to update
your code for a very long time.

Andrew

kortschak

unread,
Jan 15, 2012, 9:46:14 PM1/15/12
to golang-nuts
I though I might be using an old godoc, but checked that using $GOBIN/
godoc and get the same result (checked the godoc in $PATH also
matches). Just rebuilt all and see the same result.

No diffs show up in lib/godoc/, so unless there are templates
elsewhere that doesn't seem the be the problem.

On Jan 16, 12:18 pm, David Symonds <dsymo...@golang.org> wrote:
> On Mon, Jan 16, 2012 at 1:16 PM, kortschak
>

Mark Summerfield

unread,
Jan 16, 2012, 3:07:16 AM1/16/12
to Andrew Gerrand, golang-nuts
On Mon, 16 Jan 2012 10:11:47 +1100
Andrew Gerrand <a...@golang.org> wrote:
> Happy New Year!
>
> We've just tagged a new Go weekly, weekly.2012-01-15.
[snip]

Can this be considered to be the first Go 1 release candidate or will
there be formal release candidates to follow?

Thanks!

--
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Programming in Go" - ISBN 0321774639
http://www.qtrac.eu/gobook.html

Andrew Gerrand

unread,
Jan 16, 2012, 3:16:19 AM1/16/12
to Mark Summerfield, golang-nuts
On 16 January 2012 19:07, Mark Summerfield <li...@qtrac.plus.com> wrote:
> On Mon, 16 Jan 2012 10:11:47 +1100
> Andrew Gerrand <a...@golang.org> wrote:
>> Happy New Year!
>>
>> We've just tagged a new Go weekly, weekly.2012-01-15.
> [snip]
>
> Can this be considered to be the first Go 1 release candidate or will
> there be formal release candidates to follow?

It's very similar to what Go 1 will be, with a few exceptions:
- the go tool isn't ready yet,
- the exp/sql package will likely graduate to database/sql,
- some further re-organization, including moving some packages into
sub-repositories,
- the go/doc package's api is in flux,
- and, of course, we haven't packaged binary distributions yet.

Most of the churn has passed us now, so you can go ahead and start
using the weekly as if it's Go 1. Please file bugs on the issue
tracker when you find them. (search for existing reports first!)

Andrew

Tibor

unread,
Jan 16, 2012, 3:52:01 AM1/16/12
to golan...@googlegroups.com
Is there any chance Erik Unger's #1 proposal (https://groups.google.com/forum/#!topic/golang-nuts/81MNPqdGcC4) could be implemented in the next weekly as well?

Archos

unread,
Jan 16, 2012, 4:44:07 AM1/16/12
to golang-nuts
I just reinstall all my packages (16): `goinstall -a -u -nuke` and I
get an extrange error with one of them:

$ goinstall github.com/kless/Go-Inline/quest
question.go:17: syntax error: unexpected <, expecting semicolon or
newline or }


https://github.com/kless/Go-Inline/blob/master/quest/question.go#L17

Andrew Gerrand

unread,
Jan 16, 2012, 4:49:53 AM1/16/12
to golan...@googlegroups.com

Unfortunately not. If the proposal had come up a month or two earlier
we would have had time to discuss it, try it out, and have the
experience to judge whether it's a good idea or not before Go 1. There
is simply not enough time to reasonably consider the proposal for Go 1
at this late stage.

Andrew

Andrew Gerrand

unread,
Jan 16, 2012, 4:51:20 AM1/16/12
to Archos, golang-nuts
On 16 January 2012 20:44, Archos <raul...@sent.com> wrote:
> I just reinstall all my packages (16): `goinstall -a -u -nuke` and I
> get an extrange error with one of them:
>
> $ goinstall github.com/kless/Go-Inline/quest
> question.go:17: syntax error: unexpected <, expecting semicolon or
> newline or }
>
>
> https://github.com/kless/Go-Inline/blob/master/quest/question.go#L17

That shows what is in the source repository, but what does the file on
your disk contain?

Andrew

Archos

unread,
Jan 16, 2012, 5:00:16 AM1/16/12
to golang-nuts
The same.

$ gotest
rm -f _test/github.com/kless/Go-Inline/quest.a
6g -p github.com/kless/Go-Inline/quest -o _gotest_.6 ansi.go
question.go question_test.go
question.go:17: syntax error: unexpected <, expecting semicolon or
newline or }
make: *** [_gotest_.6] Error 1
gotest: "/var/tmp/go/bin/gomake testpackage
GOTESTFILES=question_test.go" failed: exit status 2


On Jan 16, 9:51 am, Andrew Gerrand <a...@golang.org> wrote:

Dave Cheney

unread,
Jan 16, 2012, 5:04:37 AM1/16/12
to Archos, golang-nuts
What a strange bug, you should log an issue, here is a short test
case, I'm pretty sure it's the `Go-` in your package name.

--

package main

import "github.com/kless/Go-Inline/inline"

func main() { }

--

% 6g main.go
main.go:3: syntax error: unexpected <, expecting semicolon or newline or }

Jan Mercl

unread,
Jan 16, 2012, 5:08:26 AM1/16/12
to golan...@googlegroups.com
On Monday, January 16, 2012 11:00:16 AM UTC+1, Archos wrote:

I'm able to reproduce the error with latest weekly. The file in question doesn't seem to contain the offending character at line 17:

11:06:28 jnml@shinigami$ cat -n  /home/jnml/go/src/pkg/github.com/kless/Go-Inline/quest/question.go | head -n 20
     1 // Copyright 2010  The "Go-Inline" Authors
     2 //
     3 // Use of this source code is governed by the BSD 2-Clause License
     4 // that can be found in the LICENSE file.
     5 //
     6 // This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
     7 // OR CONDITIONS OF ANY KIND, either express or implied. See the License
     8 // for more details.
     9
    10 package quest
    11
    12 import (
    13 "fmt"
    14 "os"
    15 "strings"
    16
    20 )
11:06:28 jnml@shinigami:~$ 

Neither I see any encoding trouble:

11:06:28 jnml@shinigami:~$ hd  /home/jnml/go/src/pkg/github.com/kless/Go-Inline/quest/question.go | head -n 50
00000000  2f 2f 20 43 6f 70 79 72  69 67 68 74 20 32 30 31  |// Copyright 201|
00000010  30 20 20 54 68 65 20 22  47 6f 2d 49 6e 6c 69 6e  |0  The "Go-Inlin|
00000020  65 22 20 41 75 74 68 6f  72 73 0a 2f 2f 0a 2f 2f  |e" Authors.//.//|
00000030  20 55 73 65 20 6f 66 20  74 68 69 73 20 73 6f 75  | Use of this sou|
00000040  72 63 65 20 63 6f 64 65  20 69 73 20 67 6f 76 65  |rce code is gove|
00000050  72 6e 65 64 20 62 79 20  74 68 65 20 42 53 44 20  |rned by the BSD |
00000060  32 2d 43 6c 61 75 73 65  20 4c 69 63 65 6e 73 65  |2-Clause License|
00000070  0a 2f 2f 20 74 68 61 74  20 63 61 6e 20 62 65 20  |.// that can be |
00000080  66 6f 75 6e 64 20 69 6e  20 74 68 65 20 4c 49 43  |found in the LIC|
00000090  45 4e 53 45 20 66 69 6c  65 2e 0a 2f 2f 0a 2f 2f  |ENSE file..//.//|
000000a0  20 54 68 69 73 20 73 6f  66 74 77 61 72 65 20 69  | This software i|
000000b0  73 20 64 69 73 74 72 69  62 75 74 65 64 20 6f 6e  |s distributed on|
000000c0  20 61 6e 20 22 41 53 20  49 53 22 20 42 41 53 49  | an "AS IS" BASI|
000000d0  53 2c 20 57 49 54 48 4f  55 54 20 57 41 52 52 41  |S, WITHOUT WARRA|
000000e0  4e 54 49 45 53 0a 2f 2f  20 4f 52 20 43 4f 4e 44  |NTIES.// OR COND|
000000f0  49 54 49 4f 4e 53 20 4f  46 20 41 4e 59 20 4b 49  |ITIONS OF ANY KI|
00000100  4e 44 2c 20 65 69 74 68  65 72 20 65 78 70 72 65  |ND, either expre|
00000110  73 73 20 6f 72 20 69 6d  70 6c 69 65 64 2e 20 53  |ss or implied. S|
00000120  65 65 20 74 68 65 20 4c  69 63 65 6e 73 65 0a 2f  |ee the License./|
00000130  2f 20 66 6f 72 20 6d 6f  72 65 20 64 65 74 61 69  |/ for more detai|
00000140  6c 73 2e 0a 0a 70 61 63  6b 61 67 65 20 71 75 65  |ls...package que|
00000150  73 74 0a 0a 69 6d 70 6f  72 74 20 28 0a 09 22 66  |st..import (.."f|
00000160  6d 74 22 0a 09 22 6f 73  22 0a 09 22 73 74 72 69  |mt".."os".."stri|
00000170  6e 67 73 22 0a 0a 09 22  67 69 74 68 75 62 2e 63  |ngs"..."github.c|
00000180  6f 6d 2f 6b 6c 65 73 73  2f 47 6f 2d 49 6e 6c 69  |om/kless/Go-Inli|
00000190  6e 65 2f 69 6e 6c 69 6e  65 22 0a 09 22 67 69 74  |ne/inline".."git|
000001a0  68 75 62 2e 63 6f 6d 2f  6b 6c 65 73 73 2f 47 6f  |hub.com/kless/Go|
000001b0  2d 54 65 72 6d 2f 74 65  72 6d 22 0a 09 22 67 69  |-Term/term".."gi|
000001c0  74 68 75 62 2e 63 6f 6d  2f 6b 6c 65 73 73 2f 47  |thub.com/kless/G|
000001d0  6f 2d 56 61 6c 69 64 61  74 65 2f 76 61 6c 69 64  |o-Validate/valid|
000001e0  61 74 65 22 0a 29 0a 0a  2f 2f 0a 2f 2f 20 3d 3d  |ate".)..//.// ==|
000001f0  3d 20 43 6f 70 69 65 64  20 66 72 6f 6d 20 70 61  |= Copied from pa|
00000200  63 6b 61 67 65 20 22 76  61 6c 69 64 61 74 65 22  |ckage "validate"|
00000210  2e 0a 0a 63 6f 6e 73 74  20 28 0a 09 5f 20 76 61  |...const (.._ va|
00000220  6c 69 64 61 74 65 2e 4b  69 6e 64 20 3d 20 69 6f  |lidate.Kind = io|
00000230  74 61 0a 09 42 6f 6f 6c  0a 09 49 6e 74 0a 09 49  |ta..Bool..Int..I|
00000240  6e 74 36 34 0a 09 55 69  6e 74 0a 09 55 69 6e 74  |nt64..Uint..Uint|
00000250  36 34 0a 09 46 6c 6f 61  74 33 32 0a 09 46 6c 6f  |64..Float32..Flo|
00000260  61 74 36 34 0a 09 53 74  72 69 6e 67 0a 0a 09 73  |at64..String...s|
00000270  6c 69 63 65 5f 0a 09 72  65 67 65 78 70 5f 0a 29  |lice_..regexp_.)|
00000280  0a 0a 2f 2f 20 52 65 70  72 65 73 65 6e 74 73 20  |..// Represents |
00000290  74 68 65 20 6d 6f 64 69  66 69 63 61 74 69 6f 6e  |the modification|
000002a0  73 20 74 6f 20 64 6f 20  74 6f 20 74 68 65 20 74  |s to do to the t|
000002b0  65 78 74 2e 0a 63 6f 6e  73 74 20 28 0a 09 4e 4f  |ext..const (..NO|
000002c0  4e 45 20 20 20 20 20 20  20 76 61 6c 69 64 61 74  |NE       validat|
000002d0  65 2e 4d 6f 64 69 66 69  65 72 20 3d 20 31 20 3c  |e.Modifier = 1 <|
000002e0  3c 20 69 6f 74 61 0a 09  52 45 51 55 49 52 45 44  |< iota..REQUIRED|
000002f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000300  20 20 20 20 20 2f 2f 20  61 20 72 65 71 75 69 72  |     // a requir|
00000310  65 64 20 66 69 65 6c 64  0a 09 54 52 49 4d 5f 53  |ed field..TRIM_S|
11:07:20 jnml@shinigami:~$ 


Archos

unread,
Jan 16, 2012, 5:35:13 AM1/16/12
to golang-nuts
It's a strange bug since that

(1) the character "<" is not in that line, and
(2) the prefix "Go-" is used in another packages; in fact,I've in that
same file:
"github.com/kless/Go-Term/term"
"github.com/kless/Go-Validate/validate"

Archos

unread,
Jan 16, 2012, 5:45:23 AM1/16/12
to golang-nuts

Mark Summerfield

unread,
Jan 16, 2012, 7:34:48 AM1/16/12
to Andrew Gerrand, golang-nuts
On Mon, 16 Jan 2012 10:11:47 +1100
Andrew Gerrand <a...@golang.org> wrote:
> Happy New Year!
>
> We've just tagged a new Go weekly, weekly.2012-01-15.
[snip]

> The encoding/xml package has been changed to make more idiomatic use
> of struct tags, among other things. If you use the xml package please
> read the change description to see if your code is affected:
> http://code.google.com/p/go/source/detail?r=70e914beb409

The xml changes are a welcome improvement!

However, it seems a pity to me that while json stores time.Times as
ISO8601 strings, xml stores them as Unix strings:

package main
import (
"fmt"
"os"
"encoding/xml"
"encoding/json"
"time"
)
func main() {
type T struct { When time.Time `xml:",attr"` }
t := &T{time.Now()}
xml.Marshal(os.Stdout, t)
j, _ := json.Marshal(t)
fmt.Println(string(j))
}
// Output:

<T When="Mon Jan 16 12:29:28 +0000 GMT 2012"></T>
{"When":"2012-01-16T12:29:28.802511Z"}

$ hg identify
354b17404643 weekly/weekly.2012-01-15

What would really be nice would be two new functions:

json.DateTimeFormat(string)
xml.DateTimeFormat(string)

that set the format to use for time.Time values. This would make it easy
to just store dates or to store date/times formatted as one wished.

Johann Höchtl

unread,
Jan 16, 2012, 7:38:04 AM1/16/12
to golan...@googlegroups.com


Am Montag, 16. Januar 2012 00:11:47 UTC+1 schrieb Andrew Gerrand:

* encoding/json: don't marshal special float values (thanks Evan Shaw).
* encoding/xml: major Go 1 fixup (thanks Gustavo Niemeyer).

I admit I was hoping to see
http://code.google.com/p/go/issues/detail?id=2626

addressed, and think it is important for Go 1. Is the adaption still planed for Go 1?
 

Enjoy.

Andrew


Johann

Andrew Gerrand

unread,
Jan 16, 2012, 5:37:18 PM1/16/12
to golan...@googlegroups.com

Yes. We intend to resolve all issues marked Priority-Go1 (as with this
one) for the Go 1 release.

Andrew

unread,
Jan 17, 2012, 4:23:55 AM1/17/12
to golang-nuts
On Jan 16, 11:37 pm, Andrew Gerrand <a...@golang.org> wrote:
> Yes. We intend to resolve all issues marked Priority-Go1 (as with this
> one) for the Go 1 release.

There are 164 issues marked Go1. Fixing all of them in a month-or-two
is most likely impossible.

Dave Cheney

unread,
Jan 17, 2012, 4:32:34 AM1/17/12
to ⚛, golang-nuts
After watching what happened to the bug count after the feature freeze
last year around the time we started having release.rXX versions, the
amount of high quality CLs that are commited on a weekly basis, and
noting the significant increase in the number of very capable and
experienced contributors, I think it's pretty do'able.

David Symonds

unread,
Jan 17, 2012, 4:44:56 AM1/17/12
to ⚛, golang-nuts
On Tue, Jan 17, 2012 at 8:23 PM, ⚛ <0xe2.0x...@gmail.com> wrote:

Andrew said "resolve".

Dustin

unread,
Jan 17, 2012, 1:16:52 PM1/17/12
to golan...@googlegroups.com

On Sunday, January 15, 2012 3:11:47 PM UTC-8, Andrew Gerrand wrote:
 

The encoding/xml package has been changed to make more idiomatic use of struct
tags, among other things. If you use the xml package please read the change
description to see if your code is affected:
        http://code.google.com/p/go/source/detail?r=70e914beb409

  This one kind of bit me in a package I was working on.  The case sensitivity in particular is different from the JSON package and let to some confusion in one of my apps.

  For example:

package main

import (
"encoding/json"
"encoding/xml"
"fmt"
"log"
"strings"
)

type thing struct {
Field1 int
Field2 string
}

func main() {
x := `<x><field1>423</field1><field2>hello from xml</field2></x>`
j := `{"field1": 423, "field2": "hello from json"}`

tx := thing{}
if err := xml.Unmarshal(strings.NewReader(x), &tx); err != nil {
log.Fatalf("Error unmarshaling XML:  %v", err)
}

tj := thing{}
if err := json.Unmarshal([]byte(j), &tj); err != nil {
log.Fatalf("Error unmarshaling JSON:  %v", err)
}

fmt.Printf("From XML:  %#v\n", tx)
fmt.Printf("From JSON:  %#v\n", tj)
}

Jeremy Wall

unread,
Jan 17, 2012, 1:29:39 PM1/17/12
to Archos, golang-nuts
I got the same error on weekly. The same source compiles just fine on
the previous weekly but updating to the current weekly I get: syntax
error: unexpected <

I don't have code linkable anywhere but it was while parsing an import
using . "import/path". If I have time later I'll see if I can get a
minimum set of source files that demonstrate it.

andrey mirtchovski

unread,
Jan 17, 2012, 1:40:02 PM1/17/12
to Jeremy Wall, Archos, golang-nuts
change 0edee03791f4 introduced a bug that caused failed builds in the
standard go libraries at tip with the message you're seeing.

http://groups.google.com/group/golang-dev/search?group=golang-dev&q=0edee03791f4&qt_g=Search+this+group


it was backed out of, but could've been reintroduced in some form
during subsequent CLs affecting the same file: f1deaf35e1d1
9e6c84edb95e 7f0a11cd4cb8 f70600a2ef50 a9c3d197d971

kortschak

unread,
Jan 19, 2012, 3:35:57 AM1/19/12
to golang-nuts
I can see this behaviour now on tip.golang.org:

e.g. http://tip.golang.org/pkg/time/#Time.In

On Jan 16, 12:18 pm, David Symonds <dsymo...@golang.org> wrote:
> On Mon, Jan 16, 2012 at 1:16 PM, kortschak
>

Andrew Gerrand

unread,
Jan 19, 2012, 3:44:08 AM1/19/12
to kortschak, golang-nuts
On 19 January 2012 19:35, kortschak <dan.ko...@adelaide.edu.au> wrote:
> I can see this behaviour now on tip.golang.org:
>
> e.g. http://tip.golang.org/pkg/time/#Time.In

Yep, I noticed this too. I've filed an issue:
http://code.google.com/p/go/issues/detail?id=2737

Andrew

si guy

unread,
Jan 19, 2012, 8:10:39 AM1/19/12
to golan...@googlegroups.com
It looks like I can now pass multiple return values DIRECTLY into a function call eg:

import "strconv"
func myFunc(i int, e error){
   // Do something
}
func main(){
   s := "123"
   myFunc(strconv.Atoi(s)) // This would throw a multiple return in a single value context error before, now it doesn't?
}

I can't find this in the spec, am I looking in the wrong weekly? or is this some kind of glitch.

Mark Summerfield

unread,
Jan 19, 2012, 8:17:12 AM1/19/12
to golan...@googlegroups.com, sjw...@gmail.com

I thought this had been in the spec for quite a long time:
http://golang.org/doc/go_spec.html#Calls
See the para beginning "As a special case".

si guy

unread,
Jan 19, 2012, 8:41:02 AM1/19/12
to golan...@googlegroups.com, sjw...@gmail.com
huh, I don't remember that section of the spec, but I read it a while ago.

I also don't remember how long ago it was that I wrote the initial code, but I distinctly remember having to double-line hundreds of calls because of the "multiple value return in a single value context" compiler error. Maybe three months ago?
Could this be as a result of inlining being on by default now? Just a wild guess

Either way, the change is greatly appreciated.

chris dollin

unread,
Jan 19, 2012, 8:44:49 AM1/19/12
to golan...@googlegroups.com, sjw...@gmail.com

No change.

Maybe before you were doing something like "x := returnTwoValues()" ?

Chris

--
Chris "allusive" Dollin

Jan Mercl

unread,
Jan 19, 2012, 9:00:04 AM1/19/12
to golan...@googlegroups.com, sjw...@gmail.com
On Thursday, January 19, 2012 2:41:02 PM UTC+1, si guy wrote:
huh, I don't remember that section of the spec, but I read it a while ago.

I also don't remember how long ago it was that I wrote the initial code, but I distinctly remember having to double-line hundreds of calls because of the "multiple value return in a single value context" compiler error. Maybe three months ago?
Could this be as a result of inlining being on by default now? Just a wild guess

AFAIK no.
 
Either way, the change is greatly appreciated.

Nothing changed about this since at least the first public announcement. Looking at e.g. weekly.2009-11-06, it is alread there: http://goo.gl/59IDm

Jan Mercl

unread,
Jan 19, 2012, 9:01:51 AM1/19/12
to golan...@googlegroups.com
Scratch it, wrong "special case", sorry.
Reply all
Reply to author
Forward
0 new messages