This CL adds a flag parser that matches the semantics of Go's
package flag. It also changes the linkers and compilers to use
the new flag parser.
Command lines that used to work, like
8c -FVw
6c -Dfoo
5g -I/foo/bar
now need to be split into separate arguments:
8c -F -V -w
6c -D foo
5g -I /foo/bar
The new spacing will work with both old and new tools.
The new parser also allows = for arguments, as in
6c -D=foo
5g -I=/foo/bar
but that syntax will not work with the old tools.
In addition to matching standard Go binary flag parsing,
the new flag parser generates more detailed usage messages
and opens the door to long flag names.
The recently added gc flag -= has been renamed -complete.
R=remyoudompheng, daniel.morsing, minux.ma, iant
CC=golang-dev
https://golang.org/cl/7035043
The Plan 9 symbol table format defines big-endian symbol values
for portability, but we want to be able to generate an ELF object file
and let the host linker link it, as part of the solution to issue 4069.
The symbol table itself, since it is loaded into memory at run time,
must be filled in by the final host linker, using relocation directives
to set the symbol values. On a little-endian machine, the linker will
only fill in little-endian values during relocation, so we are forced
to use little-endian symbol values.
To preserve most of the original portability of the symbol table
format, we make the table itself say whether it uses big- or
little-endian values. If the table begins with the magic sequence
fe ff ff ff 00 00
then the actual table begins after those six bytes and contains
little-endian symbol values. Otherwise, the table is in the original
format and contains big-endian symbol values. The magic sequence
looks like an "end of table" entry (the fifth byte is zero), so legacy
readers will see a little-endian table as an empty table.
All the gc architectures are little-endian today, so the practical
effect of this CL is to make all the generated tables little-endian,
but if a big-endian system comes along, ld will not generate
the magic sequence, and the various readers will fall back to the
original big-endian interpretation.
R=ken2
CC=golang-dev
https://golang.org/cl/7066043
A composite literal may be parenthesized when
used as operand for the unary operator &.
R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6996053
CL6449105 changed godoc id attributes to ensure uniqueness.
This CL updates links to godoc pages in documents that used
the old id attributes.
R=golang-dev, dsymonds
CC=golang-dev, speter.go1
https://golang.org/cl/7015051
An error during the compilation can be more precise
than an error at link time.
For 'func init', the error happens always: you can't forward
declare an init func because the name gets mangled.
For other funcs, the error happens only with the special
(and never used by hand) -= flag, which tells 6g the
package is pure go.
The go command now passes -= for pure Go packages.
Fixes#3705.
R=ken2
CC=golang-dev
https://golang.org/cl/6996054
Enable cgo on OpenBSD.
The OpenBSD ld.so(1) does not currently support PT_TLS sections. Work
around this by fixing up the TCB that has been provided by librthread
and reallocating a TCB with additional space for TLS. Also provide a
wrapper for pthread_create, allowing zeroed TLS to be allocated for
threads created externally to Go.
Joint work with Shenghou Ma (minux).
Requires change 6846064.
Fixes#3205.
R=golang-dev, minux.ma, iant, rsc, iant
CC=golang-dev
https://golang.org/cl/6853059
This CL breaks Go 1 API compatibility but it doesn't matter because
previous ListenUnixgram doesn't work in any use cases, oops.
The public API change is:
-pkg net, func ListenUnixgram(string, *UnixAddr) (*UDPConn, error)
+pkg net, func ListenUnixgram(string, *UnixAddr) (*UnixConn, error)
Fixes#3875.
R=rsc, golang-dev, dave
CC=golang-dev
https://golang.org/cl/6937059
This is language change. It is a backward-compatible
change but for code that relies on a run-time panic
when calling delete on a nil map (unlikely).
Fixes#4253.
R=rsc, r, iant, ken, bradfitz, rogpeppe
CC=golang-dev
https://golang.org/cl/6909060
We have been using all three terms "indices", "indexes",
and "index expressions" indiscriminatly for index values.
With this change, "index" refers to an index value,
"indices" is the plural of "index", and "index expression"
refers to an array, slice, or map indexed by an index: a[x].
R=r, rsc, iant, ken, mtj
CC=golang-dev
https://golang.org/cl/6912056
New in Go 1 will be nanosecond precision in the result of time.Now on Linux.
This will break code that stores time in external formats at microsecond
precision, reads it back, and expects to get exactly the same time.
Code like that can be fixed by using time.Now().Round(time.Microsecond)
instead of time.Now() in those contexts.
R=golang-dev, bradfitz, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/6903050
The spec didn't preclude invalid type assertions and
type switches, i.e., cases where a concrete type doesn't
implement the interface type in the assertion in the first
place. Both, the gc and gccgo compiler exclude these cases.
This is documenting the status quo.
Also:
- minor clean up of respective examples
- added sentence about default case in select statements
Fixes#4472.
R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6869050
Also:
- 'for' statements with a range clause do not accept send-only
channels
- '_, _ = range ch' is not equivalent to "_ = range ch" if ch
is a channel (rewriting the latter to the former leads to
an invalid range clause).
These clarifications document the status quo.
R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/6874053
1) Built-ins are restricted like for expression statements.
This documents the status quo.
2) Calls cannot be parenthesized. The spec is not clear. gccgo
permits it already, gc doesn't. Be explicit in the spec.
Fixes#4462.
R=rsc, iant, r, ken, lvd
CC=golang-dev
https://golang.org/cl/6861043
We have the notion of a PackageName, not package identifier.
As is, it could construed that imports that rename a package
don't have an "imported package identifier" but a local one.
R=r, rsc, iant, ken, dsymonds
CC=golang-dev
https://golang.org/cl/6858049
Do not skip the first symbol in the symbol table. Any other indexes
into the symbol table (for example, indexes in relocation entries)
will now refer to the symbol following the one that was intended.
Add an object that contains debug relocations, which debug/dwarf
failed to decode correctly. Extend the relocation tests to cover
this case.
Note that the existing tests passed since the symbol following the
symbol that required relocation is also of type STT_SECTION.
Fixes#4107.
R=golang-dev, mikioh.mikioh, iant, iant
CC=golang-dev
https://golang.org/cl/6848044
This is an attempt at making the interaction between
these three constructs clearer. Specifically:
- return statements terminate a function, execute deferred
functions, return to the caller, and then execution
continues after the call
- panic calls terminate a function, execute deferred
functions, return to the caller, and then re-panic
- deferred functions are executed before a function _returns_
to its caller
The hope is that with this change it becomes clear when a
deferred function is executed (when a function returns),
and when it is not (when a program exits).
R=r, rsc, iant, ken, iant
CC=golang-dev
https://golang.org/cl/6736071
Both gc and gccgo always checked this for constant
expressions but the spec only mentions run-time
exceptions.
This CL also requires that constant divisors
must not be zero in non-constant integer expressions:
This is consistent with the spirit of the most
recent changes and it is consistent with constant
expressions. We don't want to specify the effect for
non-integer expressions (f/0.0 where f is a float or
complex number) because there the result f/g is not
further specified if a non-constant g is 0.
R=r, rsc, iant, ken, andybalholm, iant
CC=golang-dev
https://golang.org/cl/6710045
This is a language change: Until now, the spec required run-
time panics for some of these errors. Note that gc and gccgo
implemented this inconsistently, and that both compilers already
reported compile-time errors in some cases. This change makes
make() behave along the same vein as index expressions.
This addresses the spec aspect of issue 4085.
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6725053
At the moment, gc and gccgo report compile-
time errors for certain constant indexes that
are out of bounds. The spec however requests
a run-time panic for out-of-bounds indexes
(http://tip.golang.org/ref/spec#Indexes).
Document the status quo.
Fixes#4231.
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6699048
Proposed new text to make matters clearer. The existing text was
unclear about the state of result parameters when panicking.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6653047
0. windows uses all.bat instead of ./all.bash
1. correct expected all.bash output
2. mention you need to use an application specific password
if you're using 2-step verification
3. note you can edit files included in CL by 'hg change NNNN'
or 'hg file'
R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/6615060
Fixes#3733Fixes#2149
Updated Syntax
Added part3.go example program
Added part3-errorhandling.go example program
Improved wording in some places
R=golang-dev, adg, minux.ma
CC=golang-dev
https://golang.org/cl/6636048
It's already there but only in the "for instance" and so not
clear enough: deferred functions run after
the result parameters are updated.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6631058
Mercurial has supported environment variables in hgrc files since
version 1.4 (released November 2009).
R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/6619067
For golang.org I intend to rewrite the jquery link in godoc.html
to point to the Google-hosted jquery.js.
R=dsymonds, minux.ma
CC=golang-dev
https://golang.org/cl/6589071
Also: Be explicit what operator means with respect to conversion types.
The parenthesis requirement is a language change. At the moment,
literal function types in conversions that cannot possibly be
followed by a '(' don't need parentheses. For instance:
func(int)int(x) -> same as (func(int)int)(x)
func()()(x) -> same as (func())(x)
but:
func(int)(x) -> could be func(int)x {...}
Fixes#4109.
R=rsc, r, iant, ken, iant
CC=golang-dev
https://golang.org/cl/6584065
Link to the "installing from source" docs instead of the "installing" docs.
Remind would-be hacker to switch to the default branch from the release branch.
R=rsc
CC=golang-dev
https://golang.org/cl/6559043
Also: Adjust prose in Conversions section
to be consistent.
This is a backward-compatible syntax change.
For a discussion see issue 2568.
Fixes#2568.
Fixes#4123.
R=golang-dev, r, iant, rsc
CC=golang-dev
https://golang.org/cl/6572049
The assembly offsets were converted mechanically using
code.google.com/p/rsc/cmd/asmlint. The instruction
changes were done by hand.
Fixes#2188.
R=iant, r, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/6550058
This was misleading and often confusing for new users.
Leaving the actual weekly release history page for historical reference.
R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/6555053
When I was a lad (and well past), users were in /usr;
now they're somewhere else, I'm told.
Kids today.
Fixes#4122.
R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/6552060
Function and method calls are valid expression statements,
but calling certain built-in functions is not permitted.
Enumerate the built-ins.
Also: unsafe.Offsetof permits parenthesized selectors as
arguments.
This is simply documenting existing compiler behavior
(both gc and gccgo agree).
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6498138
Both gc and gccgo permit calls such as unsafe.Sizeof(42). The
spec only permits variable arguments. This is a (backward-compatible)
spec change reflecting the status quo. Seems preferrable over
restricting the compilers.
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6494140
Strings happen to be represented similarly to
byte slices internally, but they don't quite
behave like them: While strings can be indexed,
sliced, and have their len() taken like byte
slices, string elements are not addressable,
make() and cap() is not supported, range loops
operate differently, and they are immutable (and
thus behave like values rather then references).
Fixes#4018.
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6503116
This change messes with anchor links. It obscures the item being linked to.
I don't see a way around it. Undoing for now.
Fixes#4071.
««« original CL description
doc css: topbar sticks to the top of large windows.
Rationale: for large screens, the convenience of not having to scroll
to the top of the page to do a search outweighs having less vertical
space.
Tested with Chrome, Firefox, Safari with various window and text sizes.
R=adg
CC=gobot, golang-dev
https://golang.org/cl/6493071
Committer: Andrew Gerrand <adg@golang.org>
»»»
R=golang-dev, r, dsymonds
CC=golang-dev
https://golang.org/cl/6488121
The (and not) arguably sounds like it is trying to say something - and not what?.
Just an idea, won't be hurt if it gets rejected.
R=gri, dsymonds, r
CC=golang-dev
https://golang.org/cl/6498115
Rationale: for large screens, the convenience of not having to scroll
to the top of the page to do a search outweighs having less vertical
space.
Tested with Chrome, Firefox, Safari with various window and text sizes.
R=adg
CC=gobot, golang-dev
https://golang.org/cl/6493071
A race between
a = "hello, world"
and
print(a)
is not guaranteed to print either "hello, world" or "".
Its behaviour is undefined.
Fixes#4039.
R=rsc
CC=dvyukov, gobot, golang-dev, r
https://golang.org/cl/6489075
After further deliberation, let's back down to the Unicode proposal.
Ignoring aBOMinations anywhere means that things like
grep unsafe *.go
might fail because there's a BOM in the middle: unBOMsafe.
R=golang-dev, rsc, 0xjnml, gri, bradfitz
CC=golang-dev
https://golang.org/cl/6490091