Godefs was a C program that ran gcc and then parsed the
stabs debugging information in the resulting object file to
generate C or Go code for bootstrapping as part of
package runtime or package syscall.
Cgo does the same work, but using the dwarf debugging
information. Add -godefs and -cdefs options to cgo that
mimic godefs's output, albeit with different input
(a Go program, not a C program).
This has been a "nice to have" for a while but was forced
by Apple removing stabs debugging output from their
latest compilers.
Fixes#835.
Fixes#2338.
R=golang-dev, bradfitz, r, dave, iant
CC=golang-dev
https://golang.org/cl/5367043
As the ISO 8601 week number is untrivial to compute a new method
on *Time provides year and number of week.
R=golang-dev, rsc, r, r
CC=golang-dev
https://golang.org/cl/5316074
The timespec passed to thrsleep() needs to be an absolute/realtime
value, so add the current nanotime to ns.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5374048
Types are left as nil if no DWARF information is found and
checking in the rewriting pass so that appropriate errors
with line numbers can be printed.
Fixes#2408.
R=rsc
CC=golang-dev, remy
https://golang.org/cl/5336041
Converting from polynomial constants to counted array speeds up Lgamma from 51.3 to 37.7 ns/op. Variables renamed in Gamma to avoid overlap in Lgamma.
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5359045
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.
It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another. (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)
Fixes#1644.
Fixes#1731.
Fixes#2190.
R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
Fixes crash when cgo consumes more than 8K
of stack and makes a callback.
Fixes#1328.
R=golang-dev, rogpeppe, rsc
CC=golang-dev, mpimenov
https://golang.org/cl/5371042
. removed an unnexessary initialisation.
. replaced 0 with 0L to match print format that in turn matched
the type of the original function return value.
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5306072
Allow any type in switch on interface value.
Statically check typeswitch early.
Fixes#2423.
Fixes#2424.
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5339045
Arrange the code so that it's easier to keep edits in sync.
R=golang-dev, mikioh.mikioh, bradfitz, andybalholm, rsc
CC=golang-dev
https://golang.org/cl/5345041
This contains the files that required handiwork, mostly
Makefiles with updated TARGs, plus the two packages
with modified package names.
html/template/doc.go needs a separate edit pass.
test/fixedbugs/bug358.go is not legal go so gofix fails on it.
R=rsc
CC=golang-dev
https://golang.org/cl/5340050
Also make it agree with the documentation. You get an error, unless you're
calling Add explicitly, in which case it panics since that's almost certainly
a bug. The discrepancy was caused by a panic that wasn't turned into
an error along one path; deleted the offending function for clarity.
R=r, rsc
CC=golang-dev
https://golang.org/cl/5354045
Pass tests1.dat, test 87:
<body><body><base><link><meta><title><p></title><body><p></body>
| <html>
| <head>
| <body>
| <base>
| <link>
| <meta>
| <title>
| "<p>"
| <p>
Handling the last <body> tag requires correcting the original insertion mode in useTheRulesFor.
Also pass test 88:
<textarea><p></textarea>
R=nigeltao
CC=golang-dev
https://golang.org/cl/5364047
Otherwise some OS X toolchains complain about the redeclaration
of libcgo_thread_start by multiple object files. The real definition
is in util.c.
Fixes#2167.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5364045
This CL adds an API for handling the various SSH
authenticaton methods. None and password continue
to be the only supported methods.
R=bradfitz, agl, n13m3y3r, rsc, cw
CC=golang-dev
https://golang.org/cl/5328045
- Fix function prototype for thrsleep().
- Provide enums for clock identifiers.
- Provide timespec structure for use with thrsleep().
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5360042
Use HEADER_IO macro from gopack to read archive header
The HEADER_IO macro portably reads archive headers. The
current arsize code fails in the case of archive headers produced
on plan 9 6c and read on other systems (it's not portable).
Modify lex.c to use the portable macro
Build tested (including tests) on OSX.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5323072
A single character typo ("\n" instead of "\r") meant that
HTML data using DOS line breaks (CRLF) was not detected as HTML.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5365041
Having the compiler count the number of array elements speeds up Gamma from 63.7 to 56.6 ns/op.
R=rsc, golang-dev, r
CC=golang-dev
https://golang.org/cl/5362043
The permitted filename characters should include ~ to allow
the names of user-owned branches in Launchpad.
R=golang-dev, rsc, n13m3y3r, gustavo
CC=golang-dev, gustavo.niemeyer
https://golang.org/cl/5280052
This does escaping on first execution.
template.go defines the same interface elements as package template.
It requires rather more duplication of code than I'd like, but I'm
not clear how to avoid that.
Maybe instead of
mySet.ParseGlob(...)
template.ParseSetGlob(...)
mySet.ParseFiles(...)
mySet.ParseTemplateFiles(...)
template.ParseTemplateFiles(...)
we combine these into a fileset abstraction that can be wrapped
var fileset template.FileSet
fileset.Glob(...) // Load a few files by glob
fileset.Files(...) // Load a few {{define}}d files
fileset.TemplateFiles(...) // Load a few files as template bodies
fileset.Funcs(...) // Make the givens func available to templates
// Do the parsing.
set, err := fileset.ParseSet()
// or set, err := fileset.ParseInto(set)
or provide an interface that can receive filenames and functions and
parse messages:
type Bundle interface {
TemplateFile(string)
File(string)
Funcs(FuncMap)
}
and define template.Parse* to handle the file-system stuff and send
messages to a bundle:
func ParseFiles(b Bundle, filenames ...string)
R=r, r
CC=golang-dev
https://golang.org/cl/5270042
There are three classes of methods/functions called Error:
a) The Error method in the just introduced error interface
b) Error methods that create or report errors (http.Error, etc)
c) Error methods that return errors previously associated with
the receiver (Tokenizer.Error, rows.Error, etc).
This CL introduces the convention that methods in case (c)
should be named Err.
The reasoning for the change is:
- The change differentiates the two kinds of APIs based on
names rather than just on signature, unloading Error a bit
- Err is closer to the err variable name that is so commonly
used with the intent of verifying an error
- Err is shorter and thus more convenient to be used often
on error verifications, such as in iterators following the
convention of the sql package.
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5327064
This moves DumpRequest, DumpResponse, NewChunkedReader,
and NewChunkedWriter out of http, as part of the continued
http diet plan.
Also, adds DumpRequestOut (for dumping outbound requests),
since DumpRequest's ambiguity (the "wire representation" in
what direction?) was often a source of confusion and bug
reports.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/5339041
Part of http diet plan.
More of the lesser-used and newcomer-misleading parts of http will
move here.
R=r, rsc
CC=golang-dev
https://golang.org/cl/5336049
runtime knows how to get the time of day
without allocating memory.
R=golang-dev, dsymonds, dave, hectorchu, r, cw
CC=golang-dev
https://golang.org/cl/5297078
This partially undoes 8fd7e6d070c8, but preserves its semantics.
More importantly, it results in the data about each fix being
decentralised, which makes it easier for new fixes to be added,
and other gofix users to slot new fixes in.
It also adds some useful metadata that could be used in the future.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5306092
This is Go 1 package renaming CL #4.
This one merely moves the source; the import strings will be
changed after the next weekly release.
This one moves pieces into os, text, and unicode.
exec -> os/exec
scanner -> text/scanner
tabwriter -> text/tabwriter
template -> text/template
template/parse -> text/template/parse
utf16 -> unicode/utf16
utf8 -> unicode/utf8
This should be the last of the source-rearranging CLs.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5331066
This is Go 1 package renaming CL #3.
This one merely moves the source; the import strings will be
changed after the next weekly release.
This one moves pieces into net.
http -> net/http
http/cgi -> net/http/cgi
http/fcgi -> net/http/fcgi
http/pprof -> net/http/pprof
http/httptest -> net/http/httptest
mail -> net/mail
rpc -> net/rpc
rpc/jsonrpc -> net/rpc/jsonrpc
smtp -> net/smtp
url -> net/url
Also remove rand (now math/rand) from NOTEST - it has a test.
The only edits are in Makefiles and deps.bash.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5335048
This is Go 1 package renaming CL #2.
This one merely moves the source; the import strings will be
changed after the next weekly release.
exp/template/html -> html/template
big -> math/big
cmath -> math/cmplx
rand -> math/rand
syslog -> log/syslog
The only edits are in Makefiles and deps.bash.
Note that this CL moves exp/template/html out of exp. I decided
to do that so all the renamings can be done together, even though
the API (and that of template, for that matter) is still fluid.
R=r, rsc
CC=golang-dev
https://golang.org/cl/5332053
ClientConn's main feature (pipelining support)
wasn't being used anyway. Ends up simpler to
just not use it.
This is prep for the http diet, moving ClientConn,
ServerConn, etc into http/httputil.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5305088
Now that vector is gone, there is no precedent to refer to.
This is a confusing point for people looking to use the
package.
R=golang-dev, r, cw
CC=golang-dev
https://golang.org/cl/5322069
This is Go 1 package renaming CL #1.
This one merely moves the source; the import strings will be
changed after the next weekly release.
The only edits are in Makefiles.
R=r, rsc
CC=golang-dev
https://golang.org/cl/5331060
Fixes#2355.
I have a test, but not sure if it's worth adding. Instead i've made
the patching-over in reflect.c methods more fatal and more descriptive.
R=rsc
CC=golang-dev
https://golang.org/cl/5302082
websocket spec had changed server-side requiements to return
an HTTP response with an appropriate error code (such as 400 Bad
Request) when it finds client did not send a handshake that matches
websocket protocol, rather than just closing connection.
It needs to flush out response before closing connection.
Fixes issues 2396.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5318072
mark OADDR inserted by typecheck as implicit
OCOPY takes ->left and ->right, not ->list
OMAKE*'s can all have arguments
precedence for OIND was initalized twice
fixes#2414
R=rsc, dave
CC=golang-dev
https://golang.org/cl/5319065
I promised it wouldn't last very long.
People who really need this can sync to 6a5647d82728.
««« original CL description
gc: add GOEXPERIMENT=os.Error
This won't last long, I promise.
R=ken2
CC=golang-dev
https://golang.org/cl/5330066
»»»
R=ken2
CC=golang-dev
https://golang.org/cl/5333053
The existing code uses *os.Waitmsg as an os.Error,
but *os.Waitmsg is really just a stringer.
Introduce an explicit error type for the real error.
Not to be submitted until just before error goes in;
the gofix for error updates type assertions
err.(*os.Waitmsg)
to
err.(*exec.ExitError)
The seemingly redundant String method will become
an Error method when error goes in, and will no longer
be redundant.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5331044
(The definition of ErrorList is in another file, so gofix
has no hope of getting this right.)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5330043
To make the error fix more useful, expand typecheck to gather
more information about struct fields, typecheck range statements,
typecheck indirect and index of named types, and collect information
about assignment conversions.
Also, change addImport to rename top-level uses of a to-be-imported
identifier to avoid conflicts. This duplicated some of the code in
the url fix, so that fix is now shorter.
R=iant, r, r
CC=golang-dev
https://golang.org/cl/5305066
A <a> tag generates implied end tags for any open <a> elements.
But it shouldn't do that when it is inside a table cell the the open <a>
is outside the table.
So stop the search for an open <a> when we reach a scope marker node.
Pass tests1.dat, test 78:
<a href="blah">aba<table><tr><td><a href="foo">br</td></tr>x</table>aoe
| <html>
| <head>
| <body>
| <a>
| href="blah"
| "abax"
| <table>
| <tbody>
| <tr>
| <td>
| <a>
| href="foo"
| "br"
| "aoe"
Also pass test 79:
<table><a href="blah">aba<tr><td><a href="foo">br</td></tr>x</table>aoe
R=nigeltao
CC=golang-dev
https://golang.org/cl/5320063
This CL grew the archive file name length from 16 to 64:
changeset: 909:58574851d792
user: Russ Cox <rsc@golang.org>
date: Mon Oct 20 13:53:56 2008 -0700
Back then, every x.go file in a package became an x.6 file
in the archive. It was important to be able to allow the
use of long Go source file names, hence the increase in size.
Today, all Go source files compile into a single _go_.6 file
regardless of their names, so the archive file name length
no longer needs to be long. The longer name causes some
problems on Plan 9, where the native archive format is the
same but with 16-byte names, so revert back to 16.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5333050
Correctly close table cell when </td> is read.
Because of reconstructing the active formatting elements, more than one
node may be created when reading a single token.
If both nodes are foster parented, they will be siblings, but the first
node should be the parent of the second.
Pass tests1.dat, test 77:
<a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe
| <html>
| <head>
| <body>
| <a>
| href="blah"
| "aba"
| <a>
| href="foo"
| "br"
| <a>
| href="foo"
| "x"
| <table>
| <tbody>
| <tr>
| <td>
| <a>
| href="foo"
| "aoe"
R=nigeltao
CC=golang-dev
https://golang.org/cl/5305074
Fixed error checking in exec.go to give a sensible error message when
execution is attempted before a successful parse (rather than an
outright panic).
R=r
CC=golang-dev
https://golang.org/cl/5306065
Plan 9's await() returns '' for nil exit status but programs, most notably gotest,
see this as an error return.
R=rsc
CC=golang-dev
https://golang.org/cl/5305079
Got rid of all the magic mystery globals. Now
for %N, %T, and %S, the flags +,- and # set a sticky
debug, sym and export mode, only visible in the new fmt.c.
Default is error mode. Handle h and l flags consistently with
the least side effects, so we can now change
things without worrying about unrelated things
breaking.
fixes#2361
R=rsc
CC=golang-dev
https://golang.org/cl/5316043
The payload of a data message is defined as an SSH string type,
which uses the first four bytes to encode its length. When channelData
and channelExtendedData were added I defined Payload as []byte to
be able to use it directly without a string to []byte conversion. This
resulted in the length data leaking into the payload data.
This CL fixes the bug, and restores agl's original fast path code.
Additionally, a bug whereby s.lock was not released if a packet arrived
for an invalid channel has been fixed.
Finally, as they were no longer used, I have removed
the channelData and channelExtedendData structs.
R=agl, rsc
CC=golang-dev
https://golang.org/cl/5330053
In the adoption agency algorithm, the formatting element is sometimes
removed from the list of active formatting elements and reinserted at a later index.
In that case, the bookmark showing where it is to be reinserted needs to be moved,
so that its position relative to its neighbors remains the same
(and also so that it doesn't become out of bounds).
Pass tests1.dat, test 70:
<DIV> abc <B> def <I> ghi <P> jkl </B>
| <html>
| <head>
| <body>
| <div>
| " abc "
| <b>
| " def "
| <i>
| " ghi "
| <i>
| <p>
| <b>
| " jkl "
Also pass tests through test 76:
<test attribute---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
R=nigeltao
CC=golang-dev
https://golang.org/cl/5322052
Handling os.Error is no different than handling fmt.Stringer
here, so the code is redundant now, but it will be necessary
once error goes in.
Adding it now will make gofix fix it.
R=r
CC=golang-dev
https://golang.org/cl/5331045
alerts get used as both values and errors.
Rather than introduce an alertError wrapper,
this CL just adds an Error method, which will
satisfy the error interface when the time comes.
R=agl, bradfitz
CC=golang-dev
https://golang.org/cl/5294073
It will be obsolete when error happens.
Submitting this now will make the error transition earlier,
at the cost of making a locally-built godoc viewing
/pkg/syscall or /pkg/os have some functions appear
under the Error type as constructors.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5305067
Will make gofix for error work better.
There is no other indication in this file that
these are actually error implementations.
(They are only used elsewhere.)
R=bradfitz
CC=golang-dev
https://golang.org/cl/5305068
We only guarantee that the main goroutine runs on the
main OS thread for initialization. Programs that wish to
preserve that property for main.main can call runtime.LockOSThread.
This is what programs used to do before we unleashed
goroutines during init, so it is both a simple fix and keeps
existing programs working.
R=iant, r, dave, dvyukov
CC=golang-dev
https://golang.org/cl/5309070
I found these by adding a check to govet, but the check
produces far too many false positives to be useful.
Even so, these few seem worth cleaning up.
R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/5311067
goinstall has built in support for a few common code hosting sites. The
identification of which vcs tool should be used was based purely on a
regex match against the provided import path. The problem with this
approach is that it requires distinct import paths for different vcs
tools on the same site.
Since bitbucket has recently starting hosting Git repositories under the
same bitbucket.org/user/project scheme as it already hosts Mercurial
repositories, now would seem a good time to take a more flexible
approach.
We still match the import path against a list of regexes, but now the
match is purely to distinguish the different hosting sites. Once the
site is identified, the specified function is called with the repo and
path matched out of the import string. This function is responsible for
creating the vcsMatch structure that tells us what we need to download
the code.
For github and launchpad, only one vcs tool is currently supported, so
these functions can simply return a vcsMatch structure. For googlecode,
we retain the behaviour of determing the vcs from the import path - but
now it is done by the function instead of the regex. For bitbucket, we
use api.bitbucket.org to find out what sort of repository the specified
import path corresponds to - and then construct the appropriate vcsMatch
structure.
R=golang-dev, adg
CC=golang-dev, rsc
https://golang.org/cl/5306069
Change the name of cas() in cc to newcase() to avoid a NIX conflict.
cas() is used in cc to create a new Case struct. There is a name
conflict in that cas() is a commonly-used
name for compare and swap. Since cas() is only used internally
in the compiler in 3 places, change the name to avoid a wider
conflict with the NIX runtime. This issue might well come up on
other OSes in the future anyway, as the name is fairly common.
R=rsc
CC=golang-dev
https://golang.org/cl/5294071
Small change to go/ast, go/parser, go/printer so that
gofix can delete the blank line left from deleting an import.
R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/5321046
Although there's still no concrete security reason not to use 3, I
think Bleichenbacher has convinced me that it's a useful defense and
it's what everyone else does.
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5307060
Nothing terribly interesting here. (!)
Since the public APIs are all in terms of UTF-8,
the changes are all internal only.
R=mpvl, gri, r
CC=golang-dev
https://golang.org/cl/5309042
API question: is a scanner token an int or a rune?
Since the rune is the common case and the token values
are the special (negative) case, I chose rune. But it could
easily go the other way.
R=gri
CC=golang-dev
https://golang.org/cl/5301049