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
> 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.
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
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
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
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
That shows what is in the source repository, but what does the file on
your disk contain?
Andrew
--
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 }
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.
* encoding/json: don't marshal special float values (thanks Evan Shaw).
* encoding/xml: major Go 1 fixup (thanks Gustavo Niemeyer).
Enjoy.
Andrew
Yes. We intend to resolve all issues marked Priority-Go1 (as with this
one) for the Go 1 release.
Andrew
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
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.
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
Yep, I noticed this too. I've filed an issue:
http://code.google.com/p/go/issues/detail?id=2737
Andrew
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".
No change.
Maybe before you were doing something like "x := returnTwoValues()" ?
Chris
--
Chris "allusive" Dollin
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.