weekly.2012-01-20

495 views
Skip to first unread message

Nigel Tao

unread,
Jan 20, 2012, 1:22:34 AM1/20/12
to golang-nuts
We've just tagged a new Go weekly, weekly.2012-01-20.

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

This weekly snapshot renamed the exp/sql package to database/sql, and
moved utf8.String from unicode/utf8 to exp/utf8string.

Package net's SetTimeout methods were changed to SetDeadline.

Many functions in package os now take a os.FileMode argument instead
of a plain uint32. An os.ModeSticky constant is also now defined.

The meaning of the first buffer element for image.YCbCr has changed to
match the semantics of the other image types like image.RGBA.

The NewMD5, NewSHA1 and NewSHA256 functions in crypto/hmac have been
deprecated. Use New instead, explicitly passing the hash function.

Other changes:
* buildscripts: move to buildscript directory (thanks Shenghou Ma).
* bytes: add the usual copyright notice to example_test.go (thanks
Olivier Duperray).
* cmd/go: remove mentions of 'gotest' from the documentation,
skip _obj directories in package scans.
* container/heap: better package documentation.
* crypto/elliptic: add constant-time P224.
* crypto/hmac: Add HMAC-SHA224 and HMAC-SHA384/512 (thanks Luit van Drongelen),
* crypto/tls: add FreeBSD root certificate location (thanks Shenghou Ma).
* crypto/x509: remove explicit uses of rsa.
* doc: various updates (thanks Jongmin Kim, Scott Lawrence, Shenghou
Ma, Stefan Nilsson).
* encoding/json: allow / and % in tag names,
document angle bracket escaping,
fix comments, tweak tests for tag names (thanks Mikio Hara).
* encoding/xml: marshal/unmarshal xml.Name in field (thanks Gustavo Niemeyer).
* exp/inotify: fix data race in linux tests.
* exp/proxy: fix build after URL changes (thanks Gustavo Niemeyer).
* exp/sql: copy when scanning into []byte by default,
rename NullableString to NullString and allow its use as a parameter.
* exp/ssh: add marshal functions for uint32 and uint64 types,
handle versions with just '\n',
rename (some) fields (thanks Christopher Wedgwood).
* exp/terminal: fix build on non-Linux using Makefiles.
* fmt: enable and fix malloc test,
* gc: don't emit pkgpath for error type,
don't fault on return outside function (thanks Scott Lawrence),
fieldnames in structliterals in exported inlines should not be
qualified if they're embedded builtin types,
fix infinite recursion for embedded interfaces,
give esc.c's sink an orig so -mm diagnostics work again,
handle printing of string/arrayrune conversions.
remove redundant code (thanks Shenghou Ma).
* go/build: no back slash in FindTree returned pkg name (thanks Alex Brainman).
* go/doc: collect imports,
don't shadow receiver.
rewrote and completed test framework.
print only one newline between paragraphs
* go/parser: expressions may have comments.
* go/scanner: fix example (thanks Olivier Duperray).
* go/token: replaced Files() with Iterate().
* godoc: add anchors to cmd documentation headings,
remove "need more packages?" link,
specify HTML page metadata with a JSON blob,
support canonical Paths in HTML metadata.
* html/template: fix docs after API changes (thanks Gustavo Niemeyer).
* html: in foreign content, check for HTML integration points in breakout.
* image/color: rename modelYCbCr to yCbCrModel (thanks Benny Siegert),
simplify documentation (thanks David Crawshaw).
* image: add PixOffset methods.
* math/rand: decrease test duration in short mode,
document default initial seed for global generator (thanks Scott Lawrence).
* mime: make FormatMediaType take full type for consistency.
* misc/cgo/test: make tests run on windows (thanks Alex Brainman).
* net/http/cgi: increase a flaky test timeout.
* net/http: change test to use override param instead of chan,
log handler panic before closing HTTP connection,
send cookies in jar on redirect (thanks Jeff Hodges),
the documentation should call NewRequest with the right signature
(thanks Christoph Hack),
update the Client docs a bit.
* net/url: cleaned up URL interface (v2) (thanks Gustavo Niemeyer).
* net: consistent log format in test (thanks Mikio Hara),
various build fixes (thanks Mikio Hara),
use NewTimer, not NewTicker, in fd_windows.go.
* old/netchan: fix data race on client hashmap.
* os/exec: trivial allocation removal in LookPath (thanks Gustavo Niemeyer).
* os: remove old note about NewSyscallError being special (thanks Alex
Brainman),
* path: added examples (thanks Sanjay Menakuru).
* pkg: Add and fix Copyright of "hand generated" files (thanks Olivier
Duperray),
add missing godoc comments to windows versions (thanks Alex Brainman).
* regexp: add SubexpNames.
* runtime: implement runtime.usleep for FreeBSD/386 and amd64 (thanks
Shenghou Ma),
madvise and SysUnused for Darwin (thanks Dave Cheney).
* sync/atomic: fix data race in tests.
* syscall: add Unix method to TimeSpec, TimeVal,
fix plan9 build (thanks Mikio Hara).
* test: change several tests to not print,
fix bug364 to actually run,
match gccgo error messages for bug345,
split golden.out into expected output per test.
* testing: do not recover example's panic (thanks Shenghou Ma),
document examples.
* text/template/parse: use human error prints.
* text/template: fix nil error on redefinition.
* time: add Since, which returns the time elapsed since some past time t.

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.2012-01-15:weekly.2012-01-20

Fair dinkum.
Nigel.

Rémy Oudompheng

unread,
Jan 20, 2012, 2:17:01 AM1/20/12
to Nigel Tao, golang-nuts
On 2012/1/20 Nigel Tao <nige...@golang.org> wrote:
> We've just tagged a new Go weekly, weekly.2012-01-20.
>
> As usual, you can update by running:
>  hg pull
>  hg update weekly
>
> This weekly snapshot renamed the exp/sql package to database/sql, and
> moved utf8.String from unicode/utf8 to exp/utf8string.
>
> Package net's SetTimeout methods were changed to SetDeadline.

Hello,

What is the recommended or suggested practice for deadlines when using
vary large granularity operations like io.Copy/ReadFrom/WriteTo ?

I suppose such code is totally not gofix-able.

Regards,
Rémy.

Gustavo Niemeyer

unread,
Jan 20, 2012, 2:32:07 AM1/20/12
to golang-nuts
> * net/url: cleaned up URL interface (v2) (thanks Gustavo Niemeyer).

Please note that this is a significant change to the interface of url.URL.

Duplicated fields from URL were dropped so that its behavior
is simple and expected when being stringified and when being
operated by packages like http. Most of the preserved fields
are in unencoded form, except for RawQuery which continues to
exist and be more easily handled via url.Query(). This means
you can now take a url from somewhere, change one of its fields,
and actually expect it to work.

The RawUserinfo field was also replaced since it wasn't practical
to use and had limitations when operating with empty usernames
and passwords which are allowed by the RFC. In its place the
Userinfo type was introduced and made accessible through the
url.User and url.UserPassword functions.

What was previous built as:

url.URL{RawUserinfo: url.EncodeUserinfo("user", ""), ...}

Is now built as:

url.URL{User: url.User("user"), ...}

--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/plus
http://niemeyer.net/twitter
http://niemeyer.net/blog

-- I'm not absolutely sure of anything.

Brad Fitzpatrick

unread,
Jan 20, 2012, 3:06:38 AM1/20/12
to Gustavo Niemeyer, golang-nuts
On Thu, Jan 19, 2012 at 11:32 PM, Gustavo Niemeyer <gus...@niemeyer.net> wrote:
> * net/url: cleaned up URL interface (v2) (thanks Gustavo Niemeyer).

Please note that this is a significant change to the interface of url.URL.

Whoops, this should've been called out louder.

This is actually one of the most exciting bits in this weekly, IMO.

Brad Fitzpatrick

unread,
Jan 20, 2012, 3:08:33 AM1/20/12
to Rémy Oudompheng, Nigel Tao, golang-nuts
If you want the older-style behavior, you can make an io.Reader wrapper type that wraps a net.Conn and renews the Deadline as Reads (potentially bounds reads of a fixed size) progress.  But no such wrappers are included, since it's not particularly obvious what people would want.

Jan Mercl

unread,
Jan 20, 2012, 3:23:40 AM1/20/12
to golan...@googlegroups.com
On Friday, January 20, 2012 9:06:38 AM UTC+1, Brad Fitzpatrick wrote:
This is actually one of the most exciting bits in this weekly, IMO.

Don't know if related, but both local godoc and weekly.golang.org now show a spurious "{ "Path": "/" }" at the their homepages (at the very top of the content immediately below the heading).

Andrew Gerrand

unread,
Jan 20, 2012, 3:30:50 AM1/20/12
to golan...@googlegroups.com

No it isn't. ;-) I just rolled back a bad push of godoc. The
2012-01-20 docs should be up soon.

Local godoc shouldn't have this issue -please rebuild and try again.

Andrew

Jan Mercl

unread,
Jan 20, 2012, 3:39:48 AM1/20/12
to golan...@googlegroups.com
On Friday, January 20, 2012 9:30:50 AM UTC+1, Andrew Gerrand wrote:

No it isn't. ;-) I just rolled back a bad push of godoc. The
2012-01-20 docs should be up soon.

Local godoc shouldn't have this issue -please rebuild and try again.

Ah, no need to rebuild, it was the previous version of the binary still running (It starts automatically at login), my bad. Locally is everything now OK, thanks.

Mark Summerfield

unread,
Jan 20, 2012, 5:00:40 AM1/20/12
to Nigel Tao, golang-nuts
On Fri, 20 Jan 2012 17:22:34 +1100
Nigel Tao <nige...@golang.org> wrote:
> We've just tagged a new Go weekly, weekly.2012-01-20.
>
> As usual, you can update by running:
> hg pull
> hg update weekly
>
> This weekly snapshot renamed the exp/sql package to database/sql, and
> moved utf8.String from unicode/utf8 to exp/utf8string.

For database/sql I see that there is also a database/sql/driver package,
but it isn't clear to me if any drivers are actually implemented. I
tried this:

package main
import (
"fmt"
"database/sql"
)
func main() {
db, err := sql.Open("sqlite", ":memory:")
fmt.Println(db, err)
}

And got:
<nil> sql: unknown driver "sqlite" (forgotten import?)

I didn't see any packages that looked like they might be drivers.

Thanks!

[snip]


--
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

Mark Summerfield

unread,
Jan 20, 2012, 5:06:30 AM1/20/12
to Nigel Tao, golang-nuts
On Fri, 20 Jan 2012 10:00:40 +0000
Mark Summerfield <li...@qtrac.plus.com> wrote:
> On Fri, 20 Jan 2012 17:22:34 +1100
> Nigel Tao <nige...@golang.org> wrote:
> > We've just tagged a new Go weekly, weekly.2012-01-20.
> >
> > As usual, you can update by running:
> > hg pull
> > hg update weekly
> >
> > This weekly snapshot renamed the exp/sql package to database/sql,
> > and moved utf8.String from unicode/utf8 to exp/utf8string.
>
> For database/sql I see that there is also a database/sql/driver
> package, but it isn't clear to me if any drivers are actually
> implemented. I tried this:
>
> package main
> import (
> "fmt"
> "database/sql"
> )
> func main() {
> db, err := sql.Open("sqlite", ":memory:")
> fmt.Println(db, err)
> }
>
> And got:
> <nil> sql: unknown driver "sqlite" (forgotten import?)
>
> I didn't see any packages that looked like they might be drivers.

I guess you have to install the drivers separately from the go
dashboard.

Seems a pity if a SQLite driver isn't included as standard though.

si guy

unread,
Jan 20, 2012, 12:50:10 PM1/20/12
to golan...@googlegroups.com
Slow build

The ./all.bash is hanging on "net/dict" with the comment [no test files] for about 10-15 minutes.
previous errkly build takes about 4 minutes on this machine

ubuntu 10.04 server on 256MB Rackspace

Johann Höchtl

unread,
Jan 20, 2012, 12:53:11 PM1/20/12
to golan...@googlegroups.com
Not for me under Kubuntu 11.10 which doens't imply there is no problem. Only one voice which says it's fine.

Kyle Lemons

unread,
Jan 20, 2012, 2:08:50 PM1/20/12
to Mark Summerfield, Nigel Tao, golang-nuts
How do you make the decision which to have in the standard library (and thus transfer responsibility for its maintenance)?  Having the driver makes it much simpler to have competing implementations without too much cognitive overload. 

Dave Cheney

unread,
Jan 20, 2012, 5:55:42 PM1/20/12
to golan...@googlegroups.com, golan...@googlegroups.com
How many cpus does your vm have? If it is more than one your vm may be swapping due to the impicit paralism of the go tool.

Cheers

Dave

Sent from my iPad

Nathan Youngman

unread,
Jan 20, 2012, 9:13:27 PM1/20/12
to golang-nuts
Hi,

Perhaps a newb question, but how do I update installed packages
against the new weekly?

➜  vendor  echo $GOPATH
/Users/nathany/Development/go/vendor:/Users/nathany/Development/go/
project
➜  vendor  go install -a
path "/Users/nathany/Development/go/vendor" not inside a GOPATH

Thanks, Nathan.

Mark Summerfield

unread,
Jan 21, 2012, 3:03:07 AM1/21/12
to Kyle Lemons, Nigel Tao, golang-nuts

Python ships with SQLite on non-Unix platforms (i.e., on platforms where
it isn't likely to be already installed); Qt ships with it but can be
told to use the system version.

It would be really convenient to have _a_ SQLite driver (and probably
SQLite itself on non-Unix platforms, e.g., Windows), so that people
would have database functionality out of the box. Also, it would provide
a model of how to do it and show where to put it in package hierarchy.

It's just an idea though:-)

John Asmuth

unread,
Jan 21, 2012, 8:19:30 AM1/21/12
to golan...@googlegroups.com, Kyle Lemons, Nigel Tao
goinstall makes it so easy to install simple 3rd party libraries like this. it's so little trouble to goinstall things that it seems not worth it to have any "this belongs in the core" discussions.

moderation

unread,
Jan 21, 2012, 9:14:59 AM1/21/12
to golan...@googlegroups.com
Is the weekly documentation up to date?  http://weekly.golang.org/pkg/net/url/ still showing RawUserinfo for example.  Gofix isn't correcting issues with that oauth.go code in the Twitterstream project at https://github.com/hoisie/twitterstream/blob/master/oauth.go

oauth.go:129: requestTokenUrl.Raw undefined (type *url.URL has no field or method Raw)

Let me know if I should be looking elsewhere for updated documentation.  Thanks.

Jan Mercl

unread,
Jan 21, 2012, 9:43:28 AM1/21/12
to golan...@googlegroups.com
On Saturday, January 21, 2012 3:14:59 PM UTC+1, moderation wrote:
Is the weekly documentation up to date?

AFAICS no. weekly.golang.org was temporarily rolled back to weekly.2012-01-15.
 
 http://weekly.golang.org/pkg/net/url/ still showing RawUserinfo for example.  Gofix isn't correcting issues with that oauth.go code in the Twitterstream project at https://github.com/hoisie/twitterstream/blob/master/oauth.go

oauth.go:129: requestTokenUrl.Raw undefined (type *url.URL has no field or method Raw)

Let me know if I should be looking elsewhere for updated documentation.  Thanks.

Local godoc is your friend ;-) 

Gustavo Niemeyer

unread,
Jan 21, 2012, 10:58:26 AM1/21/12
to golan...@googlegroups.com
On Sat, Jan 21, 2012 at 12:14, moderation <mic...@sooper.org> wrote:
> Is the weekly documentation up to date?
>  http://weekly.golang.org/pkg/net/url/ still showing RawUserinfo for

It requires updating indeed. Meanwhile, you can use this:

http://weekly.goneat.org/pkg/net/url/

At some point weekly.goneat.org and tip.goneat.org may disappear since
we now have golang.org itself doing that, but that's going to be
announced. For the moment, they continue to work and be updated
automatically without my interaction.

> example.  Gofix isn't correcting issues with that oauth.go code in the
> Twitterstream project

Unfortunately these changes are not gofixable right now. We can add a
gofix module in time for the Go 1 release, but even then certain use
cases will require manual reviewing. E.g. accessing/changing the
Raw[A-Z]* fields except for RawQuery has no good replacement, and
hopefully isn't really needed either.

> oauth.go:129: requestTokenUrl.Raw undefined (type *url.URL has no field or method Raw)

For Raw itself there's a reasonable replacement: url.String(), but I
suspect you'll have more trouble than that. The code there is using
container/vector, for instance, which is gone (slices should be used
instead).

Nathan Youngman

unread,
Jan 21, 2012, 12:27:46 PM1/21/12
to golang-nuts
Totally agree on this point.

With good installation and dependency tools, there isn't a noticeable
disadvantage vs. the "batteries included" approach. We gain the
advantage of a small core where library updates aren't waiting on the
next language release.

Nathan.

Dustin

unread,
Jan 21, 2012, 2:22:24 PM1/21/12
to golan...@googlegroups.com
Not sure if I got this before, but I did see the following error in my ARM5 build:

iface.c:76 bad mul alg
[repeated several times]

I don't think it's causing any problems, but it's mildly alarming

si guy

unread,
Jan 21, 2012, 6:27:51 PM1/21/12
to golan...@googlegroups.com
Vm has 4 CPUs. I checked it out, and it appears that the net/dict test is using more memory than before. Pulling into my swap. Doesn't look like a problem.

tomwilde

unread,
Jan 22, 2012, 9:26:21 AM1/22/12
to golan...@googlegroups.com
goinstall -clean -u -a

That will update all goinstalled packages against the new weekly.

cheers,

Tom

Nathan Youngman

unread,
Jan 22, 2012, 3:52:00 PM1/22/12
to golang-nuts
Thanks Tom.

I guess "go install" isn't quite ready for prime time yet?

Though that does make me wonder why "go" isn't just a meta command,
such that goinstall and go install do the same thing?

Nathan.

John Asmuth

unread,
Jan 22, 2012, 4:01:15 PM1/22/12
to golan...@googlegroups.com
"go install" does work right now, except that the go tool does not fetch repositories. That will be the functionality of "go get", which will at some point be invoked by "go install".

tux21b

unread,
Jan 22, 2012, 4:03:48 PM1/22/12
to golan...@googlegroups.com
On Sunday, January 22, 2012 9:52:00 PM UTC+1, Nathan Youngman wrote:
I guess "go install" isn't quite ready for prime time yet?

"go install all" (or even "go install all -a") works fine here. What problems did you have? 

Nathan Youngman

unread,
Jan 23, 2012, 2:13:27 PM1/23/12
to golan...@googlegroups.com

Tux,

"all" does the trick, sounds like a documentation glitch as "go help install" gave me no clue and the error message makes it sound like my GOPATH is wrong.

➜  vendor  echo $SHELL
/usr/local/bin/zsh
➜  vendor  go version
go version weekly.2012-01-20 11362
➜  vendor  go install -a

path "/Users/nathany/Development/go/vendor" not inside a GOPATH
➜  vendor  echo $GOPATH
/Users/nathany/Development/go/vendor:/Users/nathany/Development/go/project
➜  vendor  go install all -a  
package could not be found locally
➜  vendor  go install -a -v all
runtime
errors
sync/atomic
unicode
math
crypto/subtle
...

Same thing with other commands, like "go list" vs. "go list all".

Btw, this GOPATH error is on the previous weekly as well.

Thanks!
Nathan.
--
Nathan Youngman
Email: n...@nathany.com
Web: http://www.nathany.com
Reply all
Reply to author
Forward
0 new messages