The instructions in this document are useful but not reliable.
Explain the situation up top.
Fixes#7471.
LGTM=josharian, iant
R=golang-codereviews, josharian, iant
CC=golang-codereviews
https://golang.org/cl/96830045
The rewrite is due to Rob.
LGTM=r, bradfitz, josharian
R=golang-codereviews, bradfitz, r, josharian
CC=golang-codereviews
https://golang.org/cl/87410043
This has typically crashed in the past, although usually with
an 'all goroutines are asleep - deadlock!' message that shows
no goroutines (because there aren't any).
Previous discussion at:
https://groups.google.com/d/msg/golang-nuts/uCT_7WxxopQ/BoSBlLFzUTkJhttps://groups.google.com/d/msg/golang-dev/KUojayEr20I/u4fp_Ej5PdUJhttp://golang.org/issue/7711
There is general agreement that runtime.Goexit terminates the
main goroutine, so that main cannot return, so the program does
not exit.
The interpretation that all other goroutines exiting causes an
exit(0) is relatively new and was not part of those discussions.
That is what this CL changes.
Thankfully, even though the exit(0) has been there for a while,
some other accounting bugs made it very difficult to trigger,
so it is reasonable to replace. In particular, see golang.org/issue/7711#c10
for an examination of the behavior across past releases.
Fixes#7711.
LGTM=iant, r
R=golang-codereviews, iant, dvyukov, r
CC=golang-codereviews
https://golang.org/cl/88210044
If we compile a generated file stored in a temporary
directory - let's say /tmp/12345/work/x.c - then by default
6c stores the full path and then the pcln table in the
final binary includes the full path. This makes repeated builds
(using different temporary directories) produce different
binaries, even if the inputs are the same.
In the old 'go tool pack', the P flag specified a prefix to remove
from all stored paths (if present), and cmd/go invoked
'go tool pack grcP $WORK' to remove references to the
temporary work directory.
We've changed the build to avoid pack as much as possible,
under the theory that instead of making pack convert from
.6 to .a, the tools should just write the .a directly and save a
round of I/O.
Instead of going back to invoking pack always, define a common
flag -trimpath in the assemblers, C compilers, and Go compilers,
implemented in liblink, and arrange for cmd/go to use the flag.
Then the object files being written out have the shortened paths
from the start.
While we are here, reimplement pcln support for GOROOT_FINAL.
A build in /tmp/go uses GOROOT=/tmp/go, but if GOROOT_FINAL=/usr/local/go
is set, then a source file named /tmp/go/x.go is recorded instead as
/usr/local/go/x.go. We use this so that we can prepare distributions
to be installed in /usr/local/go without actually working in that
directory. The conversion to liblink deleted all the old file name
handling code, including the GOROOT_FINAL translation.
Bring the GOROOT_FINAL translation back.
Before this CL, using GOROOT_FINAL=/goroot make.bash:
g% strings $(which go) | grep -c $TMPDIR
6
g% strings $(which go) | grep -c $GOROOT
793
g%
After this CL:
g% strings $(which go) | grep -c $TMPDIR
0
g% strings $(which go) | grep -c $GOROOT
0
g%
(The references to $TMPDIR tend to be cgo-generated source files.)
Adding the -trimpath flag to the assemblers required converting
them to the new Go-semantics flag parser. The text in go1.3.html
is copied and adjusted from go1.1.html, which is when we applied
that conversion to the compilers and linkers.
Fixes#6989.
LGTM=iant
R=r, iant
CC=golang-codereviews
https://golang.org/cl/88300045
Also make it clear this is not a complete description of all features.
Fixes#7790.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/88300044
All that's left is net/http and the stuff I need help describing: FreeBSD and Windows.
LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/86320043
Almost all TODOS, but the structure is there and it has the details
from go1.3.txt, which is hereby deleted.
LGTM=dominik.honnef, adg
R=golang-codereviews, dominik.honnef, adg
CC=golang-codereviews
https://golang.org/cl/80240044
This rule not existing has been the source of many discussions
on golang-dev and on issues. We have stated publicly that it is
true, but we have never written it down. Write it down.
Fixes#6242.
LGTM=r, dan.kortschak, iant, dvyukov
R=golang-codereviews, r, dominik.honnef, dvyukov, dan.kortschak, iant, 0xjnml
CC=golang-codereviews
https://golang.org/cl/75130045
They aren't segmented any more, at least with gc.
Also improve the comparison of goroutines and threads.
Fixes#7373.
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/77950044
Prose referred to 'b', code used 'buf'.
Fixes#7601.
LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef
CC=golang-codereviews
https://golang.org/cl/78470043
The original test would open a local port and then immediately close it
and use the port number in subsequent tests. Between the port being closed
and reused by the later process, it could be opened by some other program
on the machine.
Changed the test to run the server process directly and have it save the
assigned port to a text file to be used by client processes.
Fixes#5564.
LGTM=adg
R=golang-codereviews, gobot, adg
CC=golang-codereviews
https://golang.org/cl/72290043
Smooth out the setup process for new contributors.
* Remove references $GOROOT (often not defined).
* Add a note for contributing to subrepositories.
* Emphasize that hg mail also uploads the latest copy.
LGTM=adg
R=golang-codereviews, iant, adg
CC=golang-codereviews
https://golang.org/cl/74370043
This documents the status quo for most implementations,
with one exception: gc generates a run-time error for
constant but out-of-range indices when slicing a constant
string. See issue 7200 for a detailed discussion.
LGTM=r
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/72160044
The underlying type of the predeclared type error is not itself,
but the interface it is defined as.
Fixes#7444.
LGTM=r, rsc
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/71790044
CLA links are now redirects. Use new URLs instead.
Also, use https:// links for all Google sites where
the http version just redirects to https anyway.
(That's all links on the page, as it turns out)
LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/69980051
This documents the implemented behavior of both
gc and gccgo as an implementation restriction.
NOT A LANGUAGE CHANGE.
Fixes#5425.
LGTM=rsc, r, iant
R=r, iant, rsc, ken
CC=golang-codereviews
https://golang.org/cl/71430043
gccgo considers built-in function calls returning a constant not as function call (issue 7386)
go/types considers any call (regular or built-in) as a function call
The wording and examples clarify that only "function calls" that are issued
at run-time (and thus do not result in a constant result) are considered
function calls in this case.
gc is inconsistent (issue 7385)
gccgo already interprets the spec accordingly and issue 7386 is moot.
go/types considers all calls (constant or not) as function calls (issue 7457).
Fixes#7387.
Fixes#7386.
LGTM=r, rsc, iant
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/66860046
An absent condition/tag in for and switch statements is equivalent
to the predeclared constant true; not simply the expression true
(which might lead to a locally defined true).
Not a language change.
Fixes#7404.
LGTM=iant, r
R=r, iant, rsc, ken
CC=golang-codereviews
https://golang.org/cl/68150046
The new flag was added by CL 68150047 (part of the NaCl replay),
but the change, like the original, omitted documentation of the
new behavior.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/68580043
crypto/tls has two functions for creating a client connection: Dial,
which most users are expected to use, and Client, which is the
lower-level API.
Dial does what you expect: it gives you a secure connection to the host
that you specify and the majority of users of crypto/tls appear to work
fine with it.
Client gives more control but needs more care. Specifically, if it
wasn't given a server name in the tls.Config then it didn't check that
the server's certificates match any hostname - because it doesn't have
one to check against. It was assumed that users of the low-level API
call VerifyHostname on the certificate themselves if they didn't supply
a hostname.
A review of the uses of Client both within Google and in a couple of
external libraries has shown that nearly all of them got this wrong.
Thus, this change enforces that either a ServerName or
InsecureSkipVerify is given. This does not affect tls.Dial.
See discussion at https://groups.google.com/d/msg/golang-nuts/4vnt7NdLvVU/b1SJ4u0ikb0J.
Fixes#7342.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/67010043
SetPanicOnFault allows recovery from unexpected memory faults.
This can be useful if you are using a memory-mapped file
or probing the address space of the current program.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/66590044
Add b.RunParallel function that captures parallel benchmark boilerplate:
creates worker goroutines, joins worker goroutines, distributes work
among them in an efficient way, auto-tunes grain size.
Fixes#7090.
R=bradfitz, iant, josharian, tracey.brendan, r, rsc, gobot
CC=golang-codereviews
https://golang.org/cl/57270043
go/build is changed to list the .m files in a package, and match them for build constraints, adding them to a new field: Package.MFiles.
The go tool is changed to support building .m files and linking in the results during CGO and SWIG builds. This means packages that create a C interface to calls Objective-C code from go are now go-gettable without producing and distributing .syso files. This change is analogous to the one in Go 1.2 made to support C++ built code.
This change doesn't support .mm files (Objective C++).
Also added support for these MFiles to go list's -json mode.
Fixes#6536.
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/60590044
This got deleted mistakenly during the content re-org.
Fixes#7275.
LGTM=dvyukov
R=golang-codereviews, minux.ma, dvyukov
CC=golang-codereviews
https://golang.org/cl/60850043
So that we don't need to update the file each time a new version is released.
LGTM=dave, r, adg
R=golang-codereviews, dave, josharian, gobot, adg, r
CC=golang-codereviews
https://golang.org/cl/48730043
Needs to be an h3, not an h2.
Thanks to Mingjie Xing for pointing it out.
LGTM=dsymonds
R=golang-codereviews, dsymonds
CC=golang-codereviews
https://golang.org/cl/55980046
Example of output:
goroutine 4 [sleep for 3 min]:
time.Sleep(0x34630b8a000)
src/pkg/runtime/time.goc:31 +0x31
main.func·002()
block.go:16 +0x2c
created by main.main
block.go:17 +0x33
Full program and output are here:
http://play.golang.org/p/NEZdADI3TdFixes#6809.
R=golang-codereviews, khr, kamil.kisiel, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/50420043
No change to the meaning, just bad writing found by
Doug McIlroy.
Let's start the new year off with a bang.
R=golang-codereviews, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/47110044
Clarify that GOROOT should only be set when using a custom install path.
Remove NetBSD from binary install page (we don't provide binaries).
Remove "What's next" links from installation instructions.
Emphasize "How to Write Go Code" page.
Fixes#6613.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/28700043
I know it's linked in the previous sentence, but this new link is where I want it to be while reading this sentence.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/21770043
Please note the slight rewording for append: The spec now
requires that append reuses the underlying array if it is
sufficiently large. Per majority sentiment.
This is technically a language change but the current
implementation always worked this way.
Fixes#5818.
Fixes#5180.
R=rsc, iant, r, ken, minux.ma, dan.kortschak, rogpeppe, go.peter.90
CC=golang-dev
https://golang.org/cl/14419054
At the moment, godoc expands the example in the link, but in
the past it has not. Add a waffle word to allow either possibility.
Also change the order of cases in the switch in Compare to
be consistent with the other switch in the function.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14439055
That page may be fine for experienced Go programmers
but it's not really targeting new programmers.
There's too much we don't know yet.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14345043
Make the break example slightly more interesting
Update #5725
Effective Go will be updated in a separate CL.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13368054
Remove "References" section.
Remove most articles and redirect to blog.golang.org.
Move /ref/spec and /ref/mem to /doc/spec and /doc/mem.
Remove duplicate links from the remaining
"Documents", "The Project", and "Help" pages.
Defer to the wiki for more links and community content.
Update command reference and mention cover tool.
Add "Pop-out" text to the front page.
Pick one of four videos at random to feature on the front page.
Fixes#2547.
Fixes#5561.
Fixes#6321.
R=r, dominik.honnef
CC=golang-dev
https://golang.org/cl/13724043
Document the semantic changes within the gc toolchain.
Also delete the mention of unbalanced right delims in template
That change was rolled back.
Absent typos, things we've forgotten, and new things that happen,
the release notes are ready.
R=golang-dev, adg, dominik.honnef
CC=golang-dev
https://golang.org/cl/13368052
Lay out the doc and write text for the minor changes.
(I left the net ones for someone who understands them better,
or for someone to describe them to me better so I can write them.)
Much still to do.
Delete go1.2.txt so there's only one thing to update.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13597044
Not a user-visible API change. Just a minor garbage
win in contrived cases.
Also, the package is io/ioutil.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12987044
(Replacement for CL 11884043.)
1) Explain a[i] and a[i:j] where a is of type *A as
shortcut for (*a)[i] and (*a)[i:j], respectively.
2) Together with 1), because len() of nil slices is
well defined, there's no need to special case nil
operands anymore.
3) The result of indexing or slicing a constant string
is always a non-constant byte or string value.
4) The result of slicing an untyped string is a value
of type string.
5) If the operand of a valid slice a[i:j] is nil (i, j
must be 0 for it to be valid - this already follows
from the in-range rules), the result is a nil slice.
Fixes#4913.
Fixes#5951.
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/12198043
CL submitted prematurely by mistake.
««« original CL description
spec: clarify index and selector expressions
1) Explain a[i] and a[i:j] where a is of type *A as
shortcut for (*a)[i] and (*a)[i:j], respectively.
2) Together with 1), because len() of nil slices is
well defined, there's no need to special case nil
operands anymore.
3) The result of indexing or slicing a constant string
is always a non-constant byte or string value.
4) The result of slicing an untyped string is a value
of type string.
5) If the operand of a valid slice a[i:j] is nil (i, j
must be 0 for it to be valid - this already follows
from the in-range rules), the result is a nil slice.
Fixes#4913.
Fixes#5951.
R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/11884043
»»»
R=r
CC=golang-dev
https://golang.org/cl/12170046
1) Explain a[i] and a[i:j] where a is of type *A as
shortcut for (*a)[i] and (*a)[i:j], respectively.
2) Together with 1), because len() of nil slices is
well defined, there's no need to special case nil
operands anymore.
3) The result of indexing or slicing a constant string
is always a non-constant byte or string value.
4) The result of slicing an untyped string is a value
of type string.
5) If the operand of a valid slice a[i:j] is nil (i, j
must be 0 for it to be valid - this already follows
from the in-range rules), the result is a nil slice.
Fixes#4913.
Fixes#5951.
R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/11884043
Phrases like "returns whether or not the image is opaque" could be
describing what the function does (it always returns, regardless of
the opacity) or what it returns (a boolean indicating the opacity).
Even when the "or not" is missing, the phrasing is bizarre.
Go with "reports whether", which is still clunky but at least makes
it clear we're talking about the return value.
These were edited by hand. A few were cleaned up in other ways.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11699043
In practice, rejecting an entire structure due to a single invalid byte
in a string is just too picky, and too hard to track down.
Be consistent with the bulk of the standard library by converting
invalid UTF-8 into UTF-8 with replacement runes.
R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/11211045
The notion of a named type is crucial for the definition
of type identity, assignability, definitions of methods.
Explicitly introduce the notion with an extra sentence.
Fixes#5682.
R=r, rsc, iant
CC=golang-dev
https://golang.org/cl/11055043
The existing compilers convert empty strings to empty
but non-nil byte and rune slices. The spec required
a nil byte and rune slice in those cases. That seems
an odd additional requirement. Adjust the spec to
match the reality.
Also, removed over-specification for conversions of
nil []byte and []rune: such nil slices already act
like empty slices and thus don't need extra language.
Added extra examples instead.
Fixes#5704.
R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/10440045
The significant change between TLS 1.0 and 1.1 is the addition of an explicit IV in the case of CBC encrypted records. Support for TLS 1.1 is needed in order to support TLS 1.2.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7880043
to avoid unintentionally clobber R9/R10.
Thanks Lucio for the suggestion.
PS: yes, this could be considered a big change (but not an API change), but
as it turns out even temporarily changes R9/R10 in user code is unsafe and
leads to very hard to diagnose problems later, better to disable using R9/R10
when the user first uses it.
See CL 6300043 and CL 6305100 for two problems caused by misusing R9/R10.
R=golang-dev, khr, rsc
CC=golang-dev
https://golang.org/cl/9840043
This fixes two intra-page "type assertion" links that were broken in
different ways.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/9797043
This text is added to doc.go:
Explicit argument indexes:
In Printf, Sprintf, and Fprintf, the default behavior is for each
formatting verb to format successive arguments passed in the call.
However, the notation [n] immediately before the verb indicates that the
nth one-indexed argument is to be formatted instead. The same notation
before a '*' for a width or precision selects the argument index holding
the value. After processing a bracketed expression [n], arguments n+1,
n+2, etc. will be processed unless otherwise directed.
For example,
fmt.Sprintf("%[2]d %[1]d\n", 11, 22)
will yield "22, 11", while
fmt.Sprintf("%[3]*[2].*[1]f", 12.0, 2, 6),
equivalent to
fmt.Sprintf("%6.2f", 12.0),
will yield " 12.00". Because an explicit index affects subsequent verbs,
this notation can be used to print the same values multiple times
by resetting the index for the first argument to be repeated:
fmt.Sprintf("%d %d %#[1]x %#x", 16, 17)
will yield "16 17 0x10 0x11".
The notation chosen differs from that in C, but I believe it's easier to read
and to remember (we're indexing the arguments), and compatibility with
C's printf was never a strong goal anyway.
While we're here, change the word "field" to "arg" or "argument" in the
code; it was being misused and was confusing.
R=rsc, bradfitz, rogpeppe, minux.ma, peter.armitage
CC=golang-dev
https://golang.org/cl/9680043
This is a file of hints, not a file of polished text.
Let's not try to do polished text until we start the
release process.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/9750043
Several old TODOs are either resolved now (e.g. when is a return
needed), or are from a time the language wasn't frozen (^ for uints
only). Consolidated the others.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9599044
I read docs and wrote a crawler + link checker on the plane,
which also checks for #fragments. I'll send that out later
when it's less gross.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8729050
Although one may argue that they should be legal, gc (at least)
disallows byte order marks that are not the first code point
in the file. Added a sentence to the "Implementation restriction"
clause in the "Source code representation" section to document
this better.
Lifting this restriction (again - the rule has changed at least
twice already) would not break any existing programs, should
we later decide yet again to fiddle the rules about these little
fly specks.
R=golang-dev, dsymonds, gri
CC=golang-dev
https://golang.org/cl/8649043
This version just tells you what to do, rather
than trying to teach you how it all works.
Should be much better for newcomers.
R=dave, gary.burd, alcosholik, r
CC=golang-dev
https://golang.org/cl/8247044
Also:
- put GORACE into the go env command
- do minor housekeeping on the race detector article
Fixes#4995.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8319044
Be deliberately vague, since the precise details should not be depended upon.
Fixes#5155.
R=golang-dev, gri, adg
CC=golang-dev
https://golang.org/cl/8283044
Also remove the introduction, which says what the rest of the
page says anyway.
Fixes#5182.
R=golang-dev, kamil.kisiel, r
CC=golang-dev
https://golang.org/cl/8281044
Mention support for NetBSD, OpenBSD, and cgo for linux/arm.
R=golang-dev, dvyukov, r, minux.ma, adg, bradfitz, adg
CC=golang-dev
https://golang.org/cl/8152043
- removed gratuitous empty lines that creeped into command line output
- changed comment color to a dark green so that links don't visually melt into them
- removed some TODOs
- updated doc.go
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8108044
Always use /home/you for $HOME in examples.
Trivial enough that someone else can integrate this change if they are editing go1.1.html
R=r
CC=golang-dev
https://golang.org/cl/8025043
Also:
- more consistenly use "xxx" statement rather than <code>xxx</code> statement
- fix/remove unnecessary links
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7821050
Will help people find the rules by searching the spec by
having a comment saying "missing return";
"terminating statement" does not evoke the rule to the
uninitiated.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7838044
Also adjust the implementation of applyRelocationsAMD64
so that the test added in CL 6848044 still passes.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7686049
Only the net stuff remains as significant work in the "minor changes" section.
R=golang-dev, dave, elias.naur, rsc
CC=golang-dev
https://golang.org/cl/7933044
The rule is not concistently followed by gc.
It appears that gccgo is ignoring it. go/types
does not implement this rule. However, both
gccgo and now go/types can compile/type-check
the entire std library (and thus all the shift
expressions occuring in it) w/o errors. For
more details see the discussion in issue 4883.
Fixes#4880.
Fixes#4881.
Fixes#4883.
R=rsc, r, iant, ken, ken, mtj, rogpeppe
CC=golang-dev
https://golang.org/cl/7707043
Tell Windows users how to update Mercurial's library.zip to add some missing dependencies.
Fixes#4745.
R=golang-dev, patrick.allen.higgins, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7558043
Also rename the relevant examples and make sure the working one compiles.
R=golang-dev, bradfitz, adg, iant, rsc
CC=golang-dev
https://golang.org/cl/7597043
It's a common mistake to build a recursive String method; explain it well and
show how to avoid it.
R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/7486049
Drop the phrase "reference types", which has caused confusion.
Add a section about 2D arrays, a common newbie question.
R=golang-dev, cespare, adg, rsc
CC=golang-dev
https://golang.org/cl/7423051
The only functional change is the new section
on terminating statements.
There is a minor syntax rewrite (not change)
of function declarations to make it easier to
refer to the notion of a function from all places
where it is used (function decls, method decls,
and function literals).
Includes some minor fixes/additions of missing links.
Based closely on Russ' proposal.
Fixes#65.
R=rsc, r, iant, ken, bradfitz
CC=golang-dev
https://golang.org/cl/7415050
Replacement for CL 7370053 which attempted to make fallthrough's
syntactically a part of switch statements. Because they may be
labeled, fixing that CL completely would require too much spec
surgery.
Fixes#4923.
R=r, iant, rsc, ken
CC=golang-dev
https://golang.org/cl/7416048
The Camlistore code tree rearranged after the go tool came
out. (I didn't know this link was here until I saw it in
some logs.)
R=adg
CC=golang-dev
https://golang.org/cl/7374043
This is documenting the status quo. The previous cleanup
added this language as an implementation restriction, but
at least for now it is really part of the language proper.
Fixes#4605.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7305071
The gc compilers already behave this way. It was an explicit
decision during the very long constant design discussions,
but it appears not to have made it into the spec.
Fixes#4398.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7313069
Fixes#4582.
* mentioned hg upload.
* added section on hg file.
* added small mention about being inside $GOROOT.
* added hg revert @NNNN
* reorganise the hg submit section for the common case of a non committer.
* made the Copyright section h2
* added note about leaving copyright years unchanged.
R=golang-dev, metanata4, shivakumar.gn, minux.ma, adg, shanemhansen
CC=golang-dev, metanata4
https://golang.org/cl/7278047
Fixes#4010.
This proposal avoids cluttering the main install-source.html with OS specific instructions by linking to the wiki for details. See discussion in the comments.
R=adg, minux.ma
CC=golang-dev
https://golang.org/cl/7241068
The spec is not clear about whether this is allowed or not,
but both compilers allow it, because the reflect implementation
takes advantage of it. Document current behavior.
Fixes#4679.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7303064
I am still not convinced this is a change we should make, but at least
documenting it will keep us from forgetting it as we get closer to Go 1.1.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7226064
People keep not reading all the way to the bottom of the doc
and not running hg mail.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7137057
Fixes#4186.
Back in the day, before the Go 1.0 release, $GOROOT was mandatory for building from source. Fast forward to now and $GOPATH is mandatory and $GOROOT is optional, and mainly used by those who use the binary distribution in uncommon places.
For example, most novices at least know about `sudo` as they would have used it to install the binary tarball into /usr/local. It is logical they would use the `sudo` hammer to `go get` other Go packages when faced with a permission error talking about the path they just had to use `sudo` on last time.
Even if they had read the documentation and set $GOPATH, go get will not work as expected as `sudo` masks most environment variables.
llucky(~) % ~/go/bin/go env | grep GOPATH
GOPATH="/home/dfc"
lucky(~) % sudo ~/go/bin/go env | grep GOPATH
GOPATH=""
This CL therefore proposes to remove support for using `go get` to download source into $GOROOT.
This CL also proposes an error when GOPATH=$GOROOT, as this is another place where new Go users can get stuck.
Further discussion: https://groups.google.com/d/topic/golang-nuts/VIg3fjHiHRI/discussion
R=rsc, adg, minux.ma
CC=golang-dev
https://golang.org/cl/6941058
The spec talks explicitly about rune literals but the
respective production is still called char_lit for
historic reasons. Updated the two occurences.
Fixes#4602.
R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/7070048
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