mirror of
https://github.com/golang/go.git
synced 2026-01-30 15:42:04 +03:00
Compare commits
17 Commits
dev.typeal
...
release.r5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca2cb382ba | ||
|
|
658a82a13b | ||
|
|
9f89972666 | ||
|
|
125e91a174 | ||
|
|
3854d346f6 | ||
|
|
348ffe7786 | ||
|
|
69e88b5c52 | ||
|
|
006e5e279b | ||
|
|
5af3c75e30 | ||
|
|
a7ae73d4e0 | ||
|
|
6a9e2c7279 | ||
|
|
50e57603ab | ||
|
|
d00421a6b1 | ||
|
|
b69a320781 | ||
|
|
ed54b19716 | ||
|
|
29fdaadbef | ||
|
|
5ce9a8d4fc |
10
.gitattributes
vendored
10
.gitattributes
vendored
@@ -1,10 +0,0 @@
|
||||
# Treat all files in the Go repo as binary, with no git magic updating
|
||||
# line endings. Windows users contributing to Go will need to use a
|
||||
# modern version of git and editors capable of LF line endings.
|
||||
#
|
||||
# We'll prevent accidental CRLF line endings from entering the repo
|
||||
# via the git-review gofmt checks.
|
||||
#
|
||||
# See golang.org/issue/9281
|
||||
|
||||
* -text
|
||||
20
.github/ISSUE_TEMPLATE
vendored
20
.github/ISSUE_TEMPLATE
vendored
@@ -1,20 +0,0 @@
|
||||
Please answer these questions before submitting your issue. Thanks!
|
||||
|
||||
### What version of Go are you using (`go version`)?
|
||||
|
||||
|
||||
### What operating system and processor architecture are you using (`go env`)?
|
||||
|
||||
|
||||
### What did you do?
|
||||
If possible, provide a recipe for reproducing the error.
|
||||
A complete runnable program is good.
|
||||
A link on play.golang.org is best.
|
||||
|
||||
|
||||
### What did you expect to see?
|
||||
|
||||
|
||||
### What did you see instead?
|
||||
|
||||
|
||||
7
.github/PULL_REQUEST_TEMPLATE
vendored
7
.github/PULL_REQUEST_TEMPLATE
vendored
@@ -1,7 +0,0 @@
|
||||
Please do not send pull requests to the golang/* repositories.
|
||||
|
||||
We do, however, take contributions gladly.
|
||||
|
||||
See https://golang.org/doc/contribute.html
|
||||
|
||||
Thanks!
|
||||
45
.gitignore
vendored
45
.gitignore
vendored
@@ -1,45 +0,0 @@
|
||||
.DS_Store
|
||||
*.[56789ao]
|
||||
*.a[56789o]
|
||||
*.so
|
||||
*.pyc
|
||||
._*
|
||||
.nfs.*
|
||||
[56789a].out
|
||||
*~
|
||||
*.orig
|
||||
*.rej
|
||||
*.exe
|
||||
.*.swp
|
||||
core
|
||||
*.cgo*.go
|
||||
*.cgo*.c
|
||||
_cgo_*
|
||||
_obj
|
||||
_test
|
||||
_testmain.go
|
||||
|
||||
/VERSION.cache
|
||||
/bin/
|
||||
/build.out
|
||||
/doc/articles/wiki/*.bin
|
||||
/goinstall.log
|
||||
/last-change
|
||||
/misc/cgo/life/run.out
|
||||
/misc/cgo/stdio/run.out
|
||||
/misc/cgo/testso/main
|
||||
/pkg/
|
||||
/src/*.*/
|
||||
/src/cmd/cgo/zdefaultcc.go
|
||||
/src/cmd/go/zdefaultcc.go
|
||||
/src/cmd/go/zosarch.go
|
||||
/src/cmd/internal/obj/zbootstrap.go
|
||||
/src/go/build/zcgo.go
|
||||
/src/go/doc/headscan
|
||||
/src/runtime/internal/sys/zversion.go
|
||||
/src/unicode/maketables
|
||||
/test.out
|
||||
/test/garbage/*.out
|
||||
/test/pass.out
|
||||
/test/run.out
|
||||
/test/times.out
|
||||
65
.hgignore
Normal file
65
.hgignore
Normal file
@@ -0,0 +1,65 @@
|
||||
syntax:glob
|
||||
.DS_Store
|
||||
.git
|
||||
.gitignore
|
||||
*.[568ao]
|
||||
*.ao
|
||||
*.so
|
||||
*.pyc
|
||||
._*
|
||||
.nfs.*
|
||||
[568a].out
|
||||
*~
|
||||
*.orig
|
||||
*.rej
|
||||
*.exe
|
||||
.*.swp
|
||||
core
|
||||
*.cgo*.go
|
||||
*.cgo*.c
|
||||
_cgo_*
|
||||
_obj
|
||||
_test
|
||||
_testmain.go
|
||||
build.out
|
||||
test.out
|
||||
y.tab.[ch]
|
||||
doc/htmlgen
|
||||
doc/codelab/wiki/*.bin
|
||||
misc/cgo/life/run.out
|
||||
misc/dashboard/builder/gobuilder
|
||||
misc/goplay/goplay
|
||||
src/Make.inc
|
||||
src/cmd/6a/6a
|
||||
src/cmd/?l/enam.c
|
||||
src/cmd/cc/y.output
|
||||
src/cmd/gc/builtin.c
|
||||
src/cmd/gc/mkbuiltin1
|
||||
src/cmd/gc/opnames.h
|
||||
src/cmd/gc/y.output
|
||||
src/cmd/gc/y1.tab.c
|
||||
src/cmd/gc/yerr.h
|
||||
src/cmd/goinstall/syslist.go
|
||||
src/pkg/Make.deps
|
||||
src/pkg/exp/ogle/ogle
|
||||
src/pkg/os/signal/unix.go
|
||||
src/pkg/runtime/*/asm.h
|
||||
src/pkg/runtime/goc2c
|
||||
src/pkg/runtime/mkversion
|
||||
src/pkg/runtime/runtime.acid.*
|
||||
src/pkg/runtime/runtime_defs.go
|
||||
src/pkg/runtime/version.go
|
||||
src/pkg/runtime/version_*.go
|
||||
src/pkg/unicode/maketables
|
||||
src/pkg/*.*/
|
||||
test/pass.out
|
||||
test/run.out
|
||||
test/times.out
|
||||
test/garbage/*.out
|
||||
goinstall.log
|
||||
|
||||
syntax:regexp
|
||||
^bin/
|
||||
^pkg/
|
||||
^src/cmd/(.*)/6?\1$
|
||||
^.*/core.[0-9]*$
|
||||
62
.hgtags
Normal file
62
.hgtags
Normal file
@@ -0,0 +1,62 @@
|
||||
1f0a01c93d305f1ab636c68b67346659c5b957f7 weekly.2009-11-06
|
||||
64e703cb307da550861fe740ff70a482a2c14819 weekly.2009-11-10
|
||||
b51fd2d6c16034480f26c96ba32a11c598e4638e weekly.2009-11-10.1
|
||||
cb140bac9ab0fd9f734ee443cea9ebadc9c99737 weekly.2009-11-12
|
||||
d1b75410b793309532352a6fb6b44453f052f3f4 weekly.2009-11-17
|
||||
e205103b02e7393d4719df5faac2dac808234d3f weekly.2009-12-07
|
||||
3a47d2e3882bb12129de05382a2c131bb0c00964 weekly.2009-12-09
|
||||
a6fcf4303b0a92cce4011556b1c96044252d93af weekly.2009-12-22
|
||||
3887d4d81bca78b63d620985d93f1cc06c063871 weekly.2010-01-05
|
||||
40dd722155f6d0c83fa572c1a5abf7c6ff35049f weekly.2010-01-13
|
||||
0a2770db06efe92b08b5c6f30e14b7e8db012538 weekly.2010-01-27
|
||||
db4262ce882d8445764312d41547ee8f11a7f7a9 weekly.2010-02-04
|
||||
53fec18b83e2b93baafba4733b59bb86b8c1988e weekly.2010-02-17
|
||||
4a0661b86e50eae734dbe43ed1312c4a0304676b weekly.2010-02-23
|
||||
a215d03e7ee1013b2abe3f1e2c84457ec51c68e4 weekly.2010-03-04
|
||||
194d473264c1a015803d07bed200e0c312aca43e weekly.2010-03-15
|
||||
9482fde11a02ffd57ba0561dc8a4ac338061a3ae weekly.2010-03-22
|
||||
57380d620ee6b65eb88da1c52784b62c94d7e72e weekly.2010-03-30
|
||||
f98f784927abc56a61501eba0cf225966f2b0142 weekly.2010-04-13
|
||||
6cc6c0d85fc3234fc0a5ec0a8777aa9d59d05ae8 weekly.2010-04-27
|
||||
17ded5ad443b41ac05924864798f1bd8750da344 weekly.2010-05-04
|
||||
a85ad0a640154b5d33626ad8ea15ed17e3828178 weekly.2010-05-27
|
||||
f776656df34c009f2aad142bf7b34a778404acd1 weekly.2010-06-09
|
||||
113ec27f29f18825444f6f8a3cdc156c1df28e87 weekly.2010-06-21
|
||||
b761e0299e9bf66298778cf170b0f64216e3cf7d weekly.2010-07-01
|
||||
5992bf56aa72efcea87d8dff14985fc8fcc68575 weekly.2010-07-14
|
||||
db904d88dc0ebf6ee5b55e44088915695c1223ee weekly.2010-07-29
|
||||
8884f7b4c7750481ed246c249db47b61fe752c56 weekly.2010-08-04
|
||||
07d3a97302be88af68acff34c8a089589da21d18 weekly.2010-08-11
|
||||
18926649cda7498b8aa539b3a611abcff548f09f weekly.2010-08-25
|
||||
92fcf05736e8565a485adc52da1894270e06ed09 weekly.2010-09-06
|
||||
9329773e204fed50ec686ee78cc715b624bf1b1d weekly.2010-09-15
|
||||
1eec33c03bceef5d7607ea4636185f7bf773e0e4 weekly.2010-09-22
|
||||
c2b8c9f13fb8ad2b56920d9da2928c5314ebf725 weekly.2010-09-29
|
||||
7c2e97710bf49cdbe388260958a6674afefb6c0f weekly.2010-10-13
|
||||
ca4f9687cec0b9c4732afd57b8c2786c7fe242de weekly.2010-10-13.1
|
||||
79997f0e5823ee9d13a34ca9971a9d8811df1c4a weekly.2010-10-20
|
||||
4d5b0816392116d3a3452bb275b6dab6c6456278 weekly.2010-10-27
|
||||
c627e23260c7ddf4a1fcda6ef3197c98fa22551d weekly.2010-11-02
|
||||
a7800e20064a39585aa3ee339c2b7454ae1ce6d5 weekly.2010-11-10
|
||||
c5287468fcff0f8a7bb9ffaece2a4863e7e5d83e weekly.2010-11-23
|
||||
f7e692dc29b02fba8e5d59b967880a347b53607c weekly.2010-12-02
|
||||
56e39c466cc1c49b587eb56dc2166d61151637df weekly.2010-12-08
|
||||
26f4898dc1ca18bb77f9968aca23773637e34f0d weekly.2010-12-15
|
||||
61b2c52b0d2246430395f2869d7b34e565333cf5 weekly.2010-12-15.1
|
||||
51c777dbccb9f537ebffb99244f521c05bf65df6 weekly.2010-12-22
|
||||
8eeee945e358f19405e81792db0e16a1cad14bc0 weekly.2011-01-06
|
||||
514c7ba501a1dd74d69ea2d0a2b4116802ada2b5 weekly.2011-01-12
|
||||
72f9cb714f08b98c6a65ab2f2256fad6bb16967a weekly.2011-01-19
|
||||
d8ba80011a986470a54e5262ec125105aa4adc34 weekly.2011-01-20
|
||||
5b98b59dd37292e36afb24babb2d22758928e13d weekly.2011-02-01
|
||||
867d37fb41a4d96ab7a6202fd6ad54c345494051 weekly.2011-02-01.1
|
||||
b2be017f91348d5f8cbaf42f77a99fc905044b59 weekly.2011-02-15
|
||||
322350d6fdbf11d9c404d6fc766349d824031339 weekly.2011-02-24
|
||||
21848430d60167817ca965c813a2118068ca660f weekly.2011-03-07
|
||||
c5c62aeb6267e124cf05f9622e28dbd0dc6b971d weekly.2011-03-07.1
|
||||
c5c62aeb6267e124cf05f9622e28dbd0dc6b971d release.r56
|
||||
c5c62aeb6267e124cf05f9622e28dbd0dc6b971d release
|
||||
3b4e9c85b643a35860805718323b05186dd7f235 weekly.2011-03-15
|
||||
b84e614e25161f626a6102813c41a80a15e3a625 weekly.2011-03-28
|
||||
cd89452cfea3d125aaf75a1ec8004e2f6a868d38 weekly.2011-04-04
|
||||
d6903b7fbff40c13ee7ea3177c0ae54c7f89d2e6 weekly.2011-04-13
|
||||
763
AUTHORS
763
AUTHORS
@@ -2,889 +2,140 @@
|
||||
# This file is distinct from the CONTRIBUTORS files.
|
||||
# See the latter for an explanation.
|
||||
|
||||
# Names should be added to this file as one of
|
||||
# Organization's name
|
||||
# Individual's name <submission email address>
|
||||
# Individual's name <submission email address> <email2> <emailN>
|
||||
# See CONTRIBUTORS for the meaning of multiple email addresses.
|
||||
# Names should be added to this file as
|
||||
# Name or Organization <email address>
|
||||
# The email address is not required for organizations.
|
||||
|
||||
# Please keep the list sorted.
|
||||
|
||||
A Medium Corporation
|
||||
Aamir Khan <syst3m.w0rm@gmail.com>
|
||||
Aaron France <aaron.l.france@gmail.com>
|
||||
Aaron Torres <tcboox@gmail.com>
|
||||
Abe Haskins <abeisgreat@abeisgreat.com>
|
||||
Abhinav Gupta <abhinav.g90@gmail.com>
|
||||
Adrian Nos <nos.adrian@gmail.com>
|
||||
Adrian O'Grady <elpollouk@gmail.com>
|
||||
Adrien Bustany <adrien-xx-google@bustany.org>
|
||||
Aécio Júnior <aeciodantasjunior@gmail.com>
|
||||
Ahmed Waheed Moanes <oneofone@gmail.com>
|
||||
Ahmy Yulrizka <yulrizka@gmail.com>
|
||||
Aiden Scandella <ai@uber.com>
|
||||
Ainar Garipov <gugl.zadolbal@gmail.com>
|
||||
Akihiro Suda <suda.kyoto@gmail.com>
|
||||
Akshat Kumar <seed@mail.nanosouffle.net>
|
||||
Alan Shreve <alan@inconshreveable.com>
|
||||
Albert Nigmatzianov <albertnigma@gmail.com>
|
||||
Albert Strasheim <fullung@gmail.com>
|
||||
Albert Yu <yukinying@gmail.com>
|
||||
Alberto Bertogli <albertito@blitiri.com.ar>
|
||||
Alberto Donizetti <alb.donizetti@gmail.com>
|
||||
Alberto García Hierro <alberto@garciahierro.com> <alberto.garcia.hierro@gmail.com>
|
||||
Aleksandar Dezelin <dezelin@gmail.com>
|
||||
Alessandro Arzilli <alessandro.arzilli@gmail.com>
|
||||
Alessandro Baffa <alessandro.baffa@gmail.com>
|
||||
Alex A Skinner <alex@lx.lc>
|
||||
Alex Brainman <alex.brainman@gmail.com>
|
||||
Alex Browne <stephenalexbrowne@gmail.com>
|
||||
Alex Carol <alex.carol.c@gmail.com>
|
||||
Alex Jin <toalexjin@gmail.com>
|
||||
Alex Plugaru <alex@plugaru.org> <alexandru.plugaru@gmail.com>
|
||||
Alex Schroeder <alex@gnu.org>
|
||||
Alex Sergeyev <abc@alexsergeyev.com>
|
||||
Alexander Demakin <alexander.demakin@gmail.com>
|
||||
Alexander Döring <email@alexd.ch>
|
||||
Alexander Larsson <alexander.larsson@gmail.com>
|
||||
Alexander Menzhinsky <amenzhinsky@gmail.com>
|
||||
Alexander Morozov <lk4d4math@gmail.com>
|
||||
Alexander Neumann <alexander@bumpern.de>
|
||||
Alexander Orlov <alexander.orlov@loxal.net>
|
||||
Alexander Reece <awreece@gmail.com>
|
||||
Alexander Surma <surma@surmair.de>
|
||||
Alexander Zhavnerchik <alex.vizor@gmail.com>
|
||||
Alexander Zolotov <goldifit@gmail.com>
|
||||
Alexandre Cesaro <alexandre.cesaro@gmail.com>
|
||||
Alexandre Fiori <fiorix@gmail.com>
|
||||
Alexandre Normand <alexandre.normand@gmail.com>
|
||||
Alexei Sholik <alcosholik@gmail.com>
|
||||
Alexey Borzenkov <snaury@gmail.com>
|
||||
Alexey Palazhchenko <alexey.palazhchenko@gmail.com>
|
||||
Aliaksandr Valialkin <valyala@gmail.com>
|
||||
Alif Rachmawadi <subosito@gmail.com>
|
||||
Allan Simon <allan.simon@supinfo.com>
|
||||
Alok Menghrajani <alok.menghrajani@gmail.com>
|
||||
Amazon.com, Inc
|
||||
Amir Mohammad Saied <amir@gluegadget.com>
|
||||
Amrut Joshi <amrut.joshi@gmail.com>
|
||||
Andre Nathan <andrenth@gmail.com>
|
||||
Andreas Auernhammer <aead@mail.de>
|
||||
Andreas Litt <andreas.litt@gmail.com>
|
||||
Andrei Korzhevskii <a.korzhevskiy@gmail.com>
|
||||
Andrei Vieru <euvieru@gmail.com>
|
||||
Andrew Austin <andrewaclt@gmail.com>
|
||||
Andrew Balholm <andybalholm@gmail.com>
|
||||
Andrew Bonventre <andybons@chromium.org>
|
||||
Andrew Bursavich <abursavich@gmail.com>
|
||||
Andrew Ekstedt <andrew.ekstedt@gmail.com>
|
||||
Andrew Etter <andrew.etter@gmail.com>
|
||||
Andrew Harding <andrew@spacemonkey.com>
|
||||
Andrew Lutomirski <andy@luto.us>
|
||||
Andrew Pogrebnoy <absourd.noise@gmail.com>
|
||||
Andrew Pritchard <awpritchard@gmail.com>
|
||||
Andrew Radev <andrey.radev@gmail.com>
|
||||
Andrew Skiba <skibaa@gmail.com>
|
||||
Andrew Szeto <andrew@jabagawee.com>
|
||||
Andrew Wilkins <axwalk@gmail.com>
|
||||
Andrew Williams <williams.andrew@gmail.com>
|
||||
Andrey Mirtchovski <mirtchovski@gmail.com>
|
||||
Andrey Petrov <andrey.petrov@shazow.net>
|
||||
Andriy Lytvynov <lytvynov.a.v@gmail.com>
|
||||
Andy Balholm <andy@balholm.com>
|
||||
Andy Davis <andy@bigandian.com>
|
||||
Andy Finkenstadt <afinkenstadt@zynga.com>
|
||||
Andy Maloney <asmaloney@gmail.com>
|
||||
Anfernee Yongkun Gui <anfernee.gui@gmail.com>
|
||||
Angelo Bulfone <mbulfone@gmail.com>
|
||||
Anh Hai Trinh <anh.hai.trinh@gmail.com>
|
||||
Anmol Sethi <anmol@aubble.com>
|
||||
Anschel Schaffer-Cohen <anschelsc@gmail.com>
|
||||
Anthony Canino <anthony.canino1@gmail.com>
|
||||
Anthony Eufemio <anthony.eufemio@gmail.com>
|
||||
Anthony Martin <ality@pbrane.org>
|
||||
Anthony Starks <ajstarks@gmail.com>
|
||||
Anthony Woods <awoods@raintank.io>
|
||||
Antonio Bibiano <antbbn@gmail.com>
|
||||
Apisak Darakananda <pongad@gmail.com>
|
||||
Aram Hăvărneanu <aram@mgk.ro>
|
||||
Areski Belaid <areski@gmail.com>
|
||||
Arlo Breault <arlolra@gmail.com>
|
||||
ARM Ltd.
|
||||
Arnaud Ysmal <arnaud.ysmal@gmail.com>
|
||||
Arne Hormann <arnehormann@gmail.com>
|
||||
Arnout Engelen <arnout@bzzt.net>
|
||||
Aron Nopanen <aron.nopanen@gmail.com>
|
||||
Artyom Pervukhin <artyom.pervukhin@gmail.com>
|
||||
Arvindh Rajesh Tamilmani <art@a-30.net>
|
||||
Atin Malaviya <amalaviy@akamai.com>
|
||||
Ato Araki <ato.araki@gmail.com>
|
||||
Audrey Lim <audreylh@gmail.com>
|
||||
Augusto Roman <aroman@gmail.com>
|
||||
Aulus Egnatius Varialus <varialus@gmail.com>
|
||||
awaw fumin <awawfumin@gmail.com>
|
||||
Ayanamist Yang <ayanamist@gmail.com>
|
||||
Aymerick Jéhanne <aymerick@jehanne.org>
|
||||
Baiju Muthukadan <baiju.m.mail@gmail.com>
|
||||
Ben Burkert <ben@benburkert.com>
|
||||
Ben Lubar <ben.lubar@gmail.com>
|
||||
Ben Olive <sionide21@gmail.com>
|
||||
Benjamin Black <b@b3k.us>
|
||||
Benny Siegert <bsiegert@gmail.com>
|
||||
Benoit Sigoure <tsunanet@gmail.com>
|
||||
Berengar Lehr <berengar.lehr@gmx.de>
|
||||
Billie Harold Cleek <bhcleek@gmail.com>
|
||||
Bjorn Tillenius <bjorn@tillenius.me>
|
||||
Bjorn Tipling <bjorn.tipling@gmail.com>
|
||||
Blake Gentry <blakesgentry@gmail.com>
|
||||
Blake Mizerany <blake.mizerany@gmail.com>
|
||||
Blixt <me@blixt.nyc>
|
||||
Bobby Powers <bobbypowers@gmail.com>
|
||||
Bolt
|
||||
Brady Catherman <brady@gmail.com>
|
||||
Brady Sullivan <brady@bsull.com>
|
||||
Brendan Daniel Tracey <tracey.brendan@gmail.com>
|
||||
Brett Cannon <bcannon@gmail.com>
|
||||
Brian Dellisanti <briandellisanti@gmail.com>
|
||||
Brian G. Merrell <bgmerrell@gmail.com>
|
||||
Brian Gitonga Marete <marete@toshnix.com> <bgmarete@gmail.com>
|
||||
Brian Kennedy <btkennedy@gmail.com>
|
||||
Brian Ketelsen <bketelsen@gmail.com>
|
||||
Brian Smith <ohohvi@gmail.com>
|
||||
Bryan Alexander <Kozical@msn.com>
|
||||
Bryan Ford <brynosaurus@gmail.com>
|
||||
Caine Tighe <arctanofyourface@gmail.com>
|
||||
Caleb Spare <cespare@gmail.com>
|
||||
Carl Chatfield <carlchatfield@gmail.com>
|
||||
Carl Johnson <me@carlmjohnson.net>
|
||||
Carlos Castillo <cookieo9@gmail.com>
|
||||
Carlos Cirello <uldericofilho@gmail.com>
|
||||
Case Nelson <case.nelson@gmail.com>
|
||||
Casey Marshall <casey.marshall@gmail.com>
|
||||
Cezar Sá Espinola <cezarsa@gmail.com>
|
||||
ChaiShushan <chaishushan@gmail.com>
|
||||
Charles L. Dorian <cldorian@gmail.com>
|
||||
Charles Lee <zombie.fml@gmail.com>
|
||||
Chris Dollin <ehog.hedge@gmail.com>
|
||||
Chris Farmiloe <chrisfarms@gmail.com>
|
||||
Chris Hines <chris.cs.guy@gmail.com>
|
||||
Chris Howey <howeyc@gmail.com>
|
||||
Chris Jones <chris@cjones.org>
|
||||
Chris Kastorff <encryptio@gmail.com>
|
||||
Chris Lennert <calennert@gmail.com>
|
||||
Chris McGee <sirnewton_01@yahoo.ca> <newton688@gmail.com>
|
||||
Chris Stockton <chrisstocktonaz@gmail.com>
|
||||
Christian Couder <chriscool@tuxfamily.org>
|
||||
Christian Himpel <chressie@googlemail.com>
|
||||
Christine Hansmann <chhansmann@gmail.com>
|
||||
Christoffer Buchholz <christoffer.buchholz@gmail.com>
|
||||
Christoph Hack <christoph@tux21b.org>
|
||||
Christopher Cahoon <chris.cahoon@gmail.com>
|
||||
Christopher Guiney <chris@guiney.net>
|
||||
Christopher Nelson <nadiasvertex@gmail.com>
|
||||
Christopher Nielsen <m4dh4tt3r@gmail.com>
|
||||
Christopher Redden <christopher.redden@gmail.com>
|
||||
Christopher Wedgwood <cw@f00f.org>
|
||||
CL Sung <clsung@gmail.com> <cl_sung@htc.com>
|
||||
Clement Skau <clementskau@gmail.com>
|
||||
CloudFlare Inc.
|
||||
Colin Edwards <colin@recursivepenguin.com>
|
||||
Colin Kennedy <moshen.colin@gmail.com>
|
||||
Conrad Irwin <conrad.irwin@gmail.com>
|
||||
Conrad Meyer <cemeyer@cs.washington.edu>
|
||||
CoreOS, Inc.
|
||||
Corey Thomasson <cthom.lists@gmail.com>
|
||||
Cristian Staretu <unclejacksons@gmail.com>
|
||||
Currant
|
||||
Cyrill Schumacher <cyrill@schumacher.fm>
|
||||
Damian Gryski <dgryski@gmail.com>
|
||||
Dan Caddigan <goldcaddy77@gmail.com>
|
||||
Dan Callahan <dan.callahan@gmail.com>
|
||||
Dan Peterson <dpiddy@gmail.com>
|
||||
Dan Sinclair <dan.sinclair@gmail.com>
|
||||
Daniel Fleischman <danielfleischman@gmail.com>
|
||||
Daniel Johansson <dajo2002@gmail.com>
|
||||
Daniel Kerwin <d.kerwin@gini.net>
|
||||
Daniel Krech <eikeon@eikeon.com>
|
||||
Daniel Lidén <daniel.liden.87@gmail.com>
|
||||
Daniel Martí <mvdan@mvdan.cc>
|
||||
Daniel Morsing <daniel.morsing@gmail.com>
|
||||
Daniel Ortiz Pereira da Silva <daniel.particular@gmail.com>
|
||||
Daniel Skinner <daniel@dasa.cc>
|
||||
Daniel Speichert <daniel@speichert.pl>
|
||||
Daniel Theophanes <kardianos@gmail.com>
|
||||
Darren Elwood <darren@textnode.com>
|
||||
Datong Sun <dndx@idndx.com>
|
||||
Dave Cheney <dave@cheney.net>
|
||||
David Brophy <dave@brophy.uk>
|
||||
David Bürgin <676c7473@gmail.com>
|
||||
David Calavera <david.calavera@gmail.com>
|
||||
David du Colombier <0intro@gmail.com>
|
||||
David Forsythe <dforsythe@gmail.com>
|
||||
David G. Andersen <dave.andersen@gmail.com>
|
||||
David Howden <dhowden@gmail.com>
|
||||
David Jakob Fritz <david.jakob.fritz@gmail.com>
|
||||
David Leon Gil <coruus@gmail.com>
|
||||
David R. Jenni <david.r.jenni@gmail.com>
|
||||
David Sansome <me@davidsansome.com>
|
||||
David Stainton <dstainton415@gmail.com>
|
||||
David Thomas <davidthomas426@gmail.com>
|
||||
David Titarenco <david.titarenco@gmail.com>
|
||||
Davies Liu <davies.liu@gmail.com>
|
||||
Dean Prichard <dean.prichard@gmail.com>
|
||||
Deepak Jois <deepak.jois@gmail.com>
|
||||
Denis Bernard <db047h@gmail.com>
|
||||
Denis Brandolini <denis.brandolini@gmail.com>
|
||||
Denys Honsiorovskyi <honsiorovskyi@gmail.com>
|
||||
Derek Buitenhuis <derek.buitenhuis@gmail.com>
|
||||
Derek Parker <parkerderek86@gmail.com>
|
||||
Derek Shockey <derek.shockey@gmail.com>
|
||||
Develer SRL
|
||||
Devon H. O'Dell <devon.odell@gmail.com>
|
||||
Dhaivat Pandit <dhaivatpandit@gmail.com>
|
||||
Dhiru Kholia <dhiru.kholia@gmail.com>
|
||||
Didier Spezia <didier.06@gmail.com>
|
||||
Dimitri Tcaciuc <dtcaciuc@gmail.com>
|
||||
Dirk Gadsden <dirk@esherido.com>
|
||||
Diwaker Gupta <diwakergupta@gmail.com>
|
||||
Dmitri Popov <operator@cv.dp-net.com>
|
||||
Dmitri Shuralyov <shurcooL@gmail.com>
|
||||
Dmitriy Dudkin <dudkin.dmitriy@gmail.com>
|
||||
Dmitriy Shelenin <deemok@googlemail.com> <deemok@gmail.com>
|
||||
Dmitry Chestnykh <dchest@gmail.com>
|
||||
Dmitry Savintsev <dsavints@gmail.com>
|
||||
Dmitry Yakunin <nonamezeil@gmail.com>
|
||||
Dominik Honnef <dominik.honnef@gmail.com>
|
||||
Donald Huang <don.hcd@gmail.com>
|
||||
Donovan Hide <donovanhide@gmail.com>
|
||||
Dropbox, Inc.
|
||||
Duncan Holm <mail@frou.org>
|
||||
Dustin Herbison <djherbis@gmail.com>
|
||||
Dustin Sallings <dsallings@gmail.com>
|
||||
Dustin Shields-Cloues <dcloues@gmail.com>
|
||||
Dvir Volk <dvir@everything.me> <dvirsky@gmail.com>
|
||||
Eden Li <eden.li@gmail.com>
|
||||
Edward Muller <edwardam@interlix.com>
|
||||
Egon Elbre <egonelbre@gmail.com>
|
||||
Ehren Kret <ehren.kret@gmail.com>
|
||||
Eivind Uggedal <eivind@uggedal.com>
|
||||
Elias Naur <elias.naur@gmail.com>
|
||||
Elliot Morrison-Reed <elliotmr@gmail.com>
|
||||
Emil Hessman <c.emil.hessman@gmail.com> <emil@hessman.se>
|
||||
Emmanuel Odeke <emm.odeke@gmail.com> <odeke@ualberta.ca>
|
||||
Empirical Interfaces Inc.
|
||||
Eoghan Sherry <ejsherry@gmail.com>
|
||||
Eric Clark <zerohp@gmail.com>
|
||||
Eric Engestrom <eric@engestrom.ch>
|
||||
Eric Lagergren <ericscottlagergren@gmail.com>
|
||||
Eric Milliken <emilliken@gmail.com>
|
||||
Eric Roshan-Eisner <eric.d.eisner@gmail.com>
|
||||
Erik Aigner <aigner.erik@gmail.com>
|
||||
Erik Dubbelboer <erik@dubbelboer.com>
|
||||
Erik St. Martin <alakriti@gmail.com>
|
||||
Erik Westrup <erik.westrup@gmail.com>
|
||||
Ernest Chiang <ernest_chiang@htc.com>
|
||||
Esko Luontola <esko.luontola@gmail.com>
|
||||
Euan Kemp <euank@euank.com>
|
||||
Evan Phoenix <evan@phx.io>
|
||||
Eric Eisner <eric.d.eisner@gmail.com>
|
||||
Evan Shaw <chickencha@gmail.com>
|
||||
Ewan Chou <coocood@gmail.com>
|
||||
Fabian Wickborn <fabian@wickborn.net>
|
||||
Fabrizio Milo <mistobaan@gmail.com>
|
||||
Faiyaz Ahmed <ahmedf@vmware.com>
|
||||
Fan Hongjian <fan.howard@gmail.com>
|
||||
Fastly, Inc.
|
||||
Fatih Arslan <fatih@arslan.io>
|
||||
Fazlul Shahriar <fshahriar@gmail.com>
|
||||
Fedor Indutny <fedor@indutny.com>
|
||||
Felix Geisendörfer <haimuiba@gmail.com>
|
||||
Filippo Valsorda <hi@filippo.io>
|
||||
Firmansyah Adiputra <frm.adiputra@gmail.com>
|
||||
Florian Uekermann <florian@uekermann-online.de>
|
||||
Florian Weimer <fw@deneb.enyo.de>
|
||||
Florin Patan <florinpatan@gmail.com>
|
||||
Ford Hurley <ford.hurley@gmail.com>
|
||||
Francisco Claude <fclaude@recoded.cl>
|
||||
Francisco Souza <franciscossouza@gmail.com>
|
||||
Frederick Kelly Mayle III <frederickmayle@gmail.com>
|
||||
Fredrik Enestad <fredrik.enestad@soundtrackyourbrand.com>
|
||||
Frithjof Schulze <schulze@math.uni-hannover.de> <sfrithjof@gmail.com>
|
||||
Frits van Bommel <fvbommel@gmail.com>
|
||||
Gabriel Aszalos <gabriel.aszalos@gmail.com>
|
||||
Gabriel Russell <gabriel.russell@gmail.com>
|
||||
Gareth Paul Jones <gpj@foursquare.com>
|
||||
Gary Burd <gary@beagledreams.com>
|
||||
Gaurish Sharma <contact@gaurishsharma.com>
|
||||
Gautham Thambidorai <gautham.dorai@gmail.com>
|
||||
Geert-Johan Riemer <gjr19912@gmail.com>
|
||||
Geoffroy Lorieux <lorieux.g@gmail.com>
|
||||
Georg Reinke <guelfey@gmail.com>
|
||||
George Shammas <george@shamm.as> <georgyo@gmail.com>
|
||||
Gerasimos Dimitriadis <gedimitr@gmail.com>
|
||||
Gideon Jan-Wessel Redelinghuys <gjredelinghuys@gmail.com>
|
||||
Giles Lean <giles.lean@pobox.com>
|
||||
Giulio Iotti <dullgiulio@gmail.com>
|
||||
Gleb Stepanov <glebstepanov1992@gmail.com>
|
||||
Google Inc.
|
||||
Gordon Klaus <gordon.klaus@gmail.com>
|
||||
Graham King <graham4king@gmail.com>
|
||||
Graham Miller <graham.miller@gmail.com>
|
||||
Greg Ward <greg@gerg.ca>
|
||||
Guillaume J. Charmes <guillaume@charmes.net>
|
||||
Guobiao Mei <meiguobiao@gmail.com>
|
||||
Gustav Paul <gustav.paul@gmail.com>
|
||||
Gustavo Niemeyer <gustavo@niemeyer.net>
|
||||
Gwenael Treguier <gwenn.kahz@gmail.com>
|
||||
Gyu-Ho Lee <gyuhox@gmail.com>
|
||||
H. İbrahim Güngör <igungor@gmail.com>
|
||||
Hajime Hoshi <hajimehoshi@gmail.com>
|
||||
Hari haran <hariharan.uno@gmail.com>
|
||||
Hariharan Srinath <srinathh@gmail.com>
|
||||
Harley Laue <losinggeneration@gmail.com>
|
||||
Harry Moreno <morenoh149@gmail.com>
|
||||
Harshavardhana <hrshvardhana@gmail.com>
|
||||
Håvard Haugen <havard.haugen@gmail.com>
|
||||
Hector Chu <hectorchu@gmail.com>
|
||||
Hector Martin Cantero <hector@marcansoft.com>
|
||||
Henning Schmiedehausen <henning@schmiedehausen.org>
|
||||
Henrik Edwards <henrik.edwards@gmail.com>
|
||||
Henrik Hodne <henrik@hodne.io>
|
||||
Herbert Georg Fischer <herbert.fischer@gmail.com>
|
||||
Hironao OTSUBO <motemen@gmail.com>
|
||||
Hiroshi Ioka <hirochachacha@gmail.com>
|
||||
Hitoshi Mitake <mitake.hitoshi@gmail.com>
|
||||
Holden Huang <ttyh061@gmail.com>
|
||||
Hong Ruiqi <hongruiqi@gmail.com>
|
||||
Hsin-Ho Yeh <yhh92u@gmail.com>
|
||||
Hu Keping <hukeping@huawei.com>
|
||||
Ian Gudger <ian@loosescre.ws>
|
||||
IBM
|
||||
Icarus Sparry <golang@icarus.freeuk.com>
|
||||
Idora Shinatose <idora.shinatose@gmail.com>
|
||||
Igneous Systems, Inc.
|
||||
Igor Dolzhikov <bluesriverz@gmail.com>
|
||||
INADA Naoki <songofacandy@gmail.com>
|
||||
Ingo Krabbe <ikrabbe.ask@gmail.com>
|
||||
Ingo Oeser <nightlyone@googlemail.com>
|
||||
Intel Corporation
|
||||
Irieda Noboru <irieda@gmail.com>
|
||||
Isaac Wagner <ibw@isaacwagner.me>
|
||||
Ivan Babrou <ivan@cloudflare.com>
|
||||
Ivan Ukhov <ivan.ukhov@gmail.com>
|
||||
Jacob Hoffman-Andrews <github@hoffman-andrews.com>
|
||||
Jae Kwon <jae@tendermint.com>
|
||||
Jakob Borg <jakob@nym.se>
|
||||
Jakub Ryszard Czarnowicz <j.czarnowicz@gmail.com>
|
||||
James Bardin <j.bardin@gmail.com>
|
||||
James Clarke <jrtc27@jrtc27.com>
|
||||
James David Chalfant <james.chalfant@gmail.com>
|
||||
James Fysh <james.fysh@gmail.com>
|
||||
James Gray <james@james4k.com>
|
||||
James Meneghello <rawrz0r@gmail.com>
|
||||
James P. Cooper <jamespcooper@gmail.com>
|
||||
James Schofield <james@shoeboxapp.com>
|
||||
James Sweet <james.sweet88@googlemail.com>
|
||||
James Toy <nil@opensesame.st>
|
||||
James Whitehead <jnwhiteh@gmail.com>
|
||||
Jamie Beverly <jamie.r.beverly@gmail.com>
|
||||
Jamil Djadala <djadala@gmail.com>
|
||||
Jan H. Hosang <jan.hosang@gmail.com>
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
Jan Mercl <befelemepeseveze@gmail.com>
|
||||
Jan Newmarch <jan.newmarch@gmail.com>
|
||||
Jan Ziak <0xe2.0x9a.0x9b@gmail.com>
|
||||
Jani Monoses <jani.monoses@ubuntu.com>
|
||||
Jaroslavas Počepko <jp@webmaster.ms>
|
||||
Jason Barnett <jason.w.barnett@gmail.com>
|
||||
Jason Del Ponte <delpontej@gmail.com>
|
||||
Jason Smale <jsmale@zendesk.com>
|
||||
Jason Travis <infomaniac7@gmail.com>
|
||||
Jay Weisskopf <jay@jayschwa.net>
|
||||
Jean-Nicolas Moal <jn.moal@gmail.com>
|
||||
Jeff Hodges <jeff@somethingsimilar.com>
|
||||
Jeff R. Allen <jra@nella.org>
|
||||
Jeff Sickel <jas@corpus-callosum.com>
|
||||
Jeff Wendling <jeff@spacemonkey.com>
|
||||
Jens Frederich <jfrederich@gmail.com>
|
||||
Jeremy Jackins <jeremyjackins@gmail.com>
|
||||
Jeroen Bobbeldijk <jerbob92@gmail.com>
|
||||
Jess Frazelle <me@jessfraz.com>
|
||||
Jesse Szwedko <jesse.szwedko@gmail.com>
|
||||
Jihyun Yu <yjh0502@gmail.com>
|
||||
Jim McGrath <jimmc2@gmail.com>
|
||||
Jimmy Zelinskie <jimmyzelinskie@gmail.com>
|
||||
Jingcheng Zhang <diogin@gmail.com>
|
||||
Jingguo Yao <yaojingguo@gmail.com>
|
||||
Jiong Du <londevil@gmail.com>
|
||||
Jirka Daněk <dnk@mail.muni.cz>
|
||||
Joakim Sernbrant <serbaut@gmail.com>
|
||||
Joe Farrell <joe2farrell@gmail.com>
|
||||
Joe Harrison <joehazzers@gmail.com>
|
||||
Joe Henke <joed.henke@gmail.com>
|
||||
Joe Poirier <jdpoirier@gmail.com>
|
||||
Joe Shaw <joe@joeshaw.org>
|
||||
Joe Sylve <joe.sylve@gmail.com>
|
||||
Joe Tsai <joetsai@digital-static.net>
|
||||
Joel Stemmer <stemmertech@gmail.com>
|
||||
Johan Sageryd <j@1616.se>
|
||||
John Asmuth <jasmuth@gmail.com>
|
||||
John C Barstow <jbowtie@amathaine.com>
|
||||
John Graham-Cumming <jgc@jgc.org> <jgrahamc@gmail.com>
|
||||
John Howard Palevich <jack.palevich@gmail.com>
|
||||
John Jeffery <jjeffery@sp.com.au>
|
||||
John Jenkins <twodopeshaggy@gmail.com>
|
||||
John Potocny <johnp@vividcortex.com>
|
||||
John Schnake <schnake.john@gmail.com>
|
||||
John Shahid <jvshahid@gmail.com>
|
||||
John Tuley <john@tuley.org>
|
||||
Jonathan Boulle <jonathanboulle@gmail.com>
|
||||
Jonathan Gold <jgold.bg@gmail.com>
|
||||
Jonathan Mark <jhmark@xenops.com>
|
||||
Jonathan Rudenberg <jonathan@titanous.com>
|
||||
Jonathan Wills <runningwild@gmail.com>
|
||||
Jongmin Kim <atomaths@gmail.com>
|
||||
Joonas Kuorilehto <joneskoo@derbian.fi>
|
||||
Joop Kiefte <ikojba@gmail.com> <joop@kiefte.net>
|
||||
Jordan Lewis <jordanthelewis@gmail.com>
|
||||
Jose Luis Vázquez González <josvazg@gmail.com>
|
||||
Joseph Holsten <joseph@josephholsten.com>
|
||||
Josh Bleecher Snyder <josharian@gmail.com>
|
||||
Josh Chorlton <jchorlton@gmail.com>
|
||||
Josh Goebel <dreamer3@gmail.com>
|
||||
Josh Holland <jrh@joshh.co.uk>
|
||||
Joshua Chase <jcjoshuachase@gmail.com>
|
||||
Jostein Stuhaug <js@solidsystem.no>
|
||||
JT Olds <jtolds@xnet5.com>
|
||||
Jukka-Pekka Kekkonen <karatepekka@gmail.com>
|
||||
Julian Kornberger <jk+github@digineo.de>
|
||||
Julian Phillips <julian@quantumfyre.co.uk>
|
||||
Julien Schmidt <google@julienschmidt.com>
|
||||
Justin Nuß <nuss.justin@gmail.com>
|
||||
Justyn Temme <justyntemme@gmail.com>
|
||||
Kai Backman <kaib@golang.org>
|
||||
Kale Blankenship <kale@lemnisys.com>
|
||||
Kamil Kisiel <kamil@kamilkisiel.net> <kamil.kisiel@gmail.com>
|
||||
Kang Hu <hukangustc@gmail.com>
|
||||
Kato Kazuyoshi <kato.kazuyoshi@gmail.com>
|
||||
Katrina Owen <katrina.owen@gmail.com>
|
||||
Kaviraj Kanagaraj <kavirajkanagaraj@gmail.com>
|
||||
Keegan Carruthers-Smith <keegan.csmith@gmail.com>
|
||||
Kei Son <hey.calmdown@gmail.com>
|
||||
Keith Ball <inflatablewoman@gmail.com>
|
||||
Keith Rarick <kr@xph.us>
|
||||
Kelsey Hightower <kelsey.hightower@gmail.com>
|
||||
Kelvin Foo Chuan Lyi <vmirage@gmail.com>
|
||||
Ken Friedenbach <kenliz@cruzio.com>
|
||||
Ken Rockot <ken@oz.gs>
|
||||
Ken Sedgwick <ken@bonsai.com>
|
||||
Kenji Kaneda <kenji.kaneda@gmail.com>
|
||||
Kenneth Shaw <kenshaw@gmail.com>
|
||||
Kenny Grant <kennygrant@gmail.com>
|
||||
Kevin Ballard <kevin@sb.org>
|
||||
Kevin Burke <kev@inburke.com>
|
||||
Kevin Kirsche <kev.kirsche@gmail.com>
|
||||
Kevin Vu <kevin.m.vu@gmail.com>
|
||||
Klaus Post <klauspost@gmail.com>
|
||||
Konstantin Shaposhnikov <k.shaposhnikov@gmail.com>
|
||||
KPCompass, Inc.
|
||||
Kristopher Watts <traetox@gmail.com>
|
||||
Kun Li <likunarmstrong@gmail.com>
|
||||
Kyle Consalus <consalus@gmail.com>
|
||||
Kyle Isom <kyle@gokyle.net>
|
||||
Kyle Lemons <kyle@kylelemons.net>
|
||||
L Campbell <unpantsu@gmail.com>
|
||||
Lai Jiangshan <eag0628@gmail.com>
|
||||
Larz Conwell <larzconwell@gmail.com>
|
||||
LE Manh Cuong <cuong.manhle.vn@gmail.com>
|
||||
Lee Hinman <hinman@gmail.com>
|
||||
Lee Packham <lpackham@gmail.com>
|
||||
Lewin Bormann <lewin.bormann@gmail.com>
|
||||
Liberty Fund Inc
|
||||
Linaro Limited
|
||||
Lloyd Dewolf <foolswisdom@gmail.com>
|
||||
Lorenzo Stoakes <lstoakes@gmail.com>
|
||||
Luan Santos <cfcluan@gmail.com>
|
||||
Luca Greco <luca.greco@alcacoop.it>
|
||||
Lucien Stuker <lucien.stuker@gmail.com>
|
||||
Lucio De Re <lucio.dere@gmail.com>
|
||||
Luigi Riefolo <luigi.riefolo@gmail.com>
|
||||
Luit van Drongelen <luitvd@gmail.com>
|
||||
Luka Zakrajšek <tr00.g33k@gmail.com>
|
||||
Luke Curley <qpingu@gmail.com>
|
||||
Maksym Trykur <maksym.trykur@gmail.com>
|
||||
Mal Curtis <mal@mal.co.nz>
|
||||
Manfred Touron <m@42.am>
|
||||
Manu S Ajith <neo@codingarena.in>
|
||||
Manuel Mendez <mmendez534@gmail.com>
|
||||
Marc Weistroff <marc@weistroff.net>
|
||||
Marcel Edmund Franke <marcel.edmund.franke@gmail.com>
|
||||
Marco Hennings <marco.hennings@freiheit.com>
|
||||
Marin Bašić <marin.basic02@gmail.com>
|
||||
Mark Bucciarelli <mkbucc@gmail.com>
|
||||
Mark Severson <miquella@gmail.com>
|
||||
Mark Theunissen <mark.theunissen@gmail.com>
|
||||
Marko Juhani Silokunnas <marko.silokunnas@gmail.com>
|
||||
Marko Tiikkaja <marko@joh.to>
|
||||
Markover Inc. DBA Poptip
|
||||
Markus Duft <markus.duft@salomon.at>
|
||||
Markus Sonderegger <marraison@gmail.com>
|
||||
Markus Zimmermann <zimmski@gmail.com>
|
||||
Martin Bertschler <mbertschler@gmail.com>
|
||||
Martin Garton <garton@gmail.com>
|
||||
Martin Hamrle <martin.hamrle@gmail.com>
|
||||
Martin Möhrmann <martisch@uos.de>
|
||||
Martin Neubauer <m.ne@gmx.net>
|
||||
Martin Olsson <martin@minimum.se>
|
||||
Marvin Stenger <marvin.stenger94@gmail.com>
|
||||
Mateusz Czapliński <czapkofan@gmail.com>
|
||||
Mathias Beke <git@denbeke.be>
|
||||
Mathias Leppich <mleppich@muhqu.de>
|
||||
Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
|
||||
Mats Lidell <mats.lidell@cag.se>
|
||||
Matt Aimonetti <mattaimonetti@gmail.com>
|
||||
Matt Bostock <matt@mattbostock.com>
|
||||
Matt Drollette <matt@drollette.com>
|
||||
Matt Jibson <matt.jibson@gmail.com>
|
||||
Matt Joiner <anacrolix@gmail.com>
|
||||
Matt Layher <mdlayher@gmail.com>
|
||||
Matt Reiferson <mreiferson@gmail.com>
|
||||
Matt Robenolt <matt@ydekproductions.com>
|
||||
Matt T. Proud <matt.proud@gmail.com>
|
||||
Matt Williams <gh@mattyw.net>
|
||||
Matthew Brennan <matty.brennan@gmail.com>
|
||||
Matthew Cottingham <mattcottingham@gmail.com>
|
||||
Matthew Denton <mdenton@skyportsystems.com>
|
||||
Matthew Holt <Matthew.Holt+git@gmail.com>
|
||||
Matthew Horsnell <matthew.horsnell@gmail.com>
|
||||
Matthieu Hauglustaine <matt.hauglustaine@gmail.com>
|
||||
Matthieu Olivier <olivier.matthieu@gmail.com>
|
||||
Max Riveiro <kavu13@gmail.com>
|
||||
Maxim Khitrov <max@mxcrypt.com>
|
||||
Maxwell Krohn <themax@gmail.com>
|
||||
MediaMath, Inc
|
||||
Meir Fischer <meirfischer@gmail.com>
|
||||
Meng Zhuo <mengzhuo1203@gmail.com>
|
||||
Meteor Development Group
|
||||
Mhd Sulhan <m.shulhan@gmail.com>
|
||||
Micah Stetson <micah.stetson@gmail.com>
|
||||
Michael Chaten <mchaten@gmail.com>
|
||||
Michael Elkins <michael.elkins@gmail.com>
|
||||
Michael Fraenkel <michael.fraenkel@gmail.com>
|
||||
Michael Gehring <mg@ebfe.org> <gnirheg.leahcim@gmail.com>
|
||||
Michael Hoisie <hoisie@gmail.com>
|
||||
Michael Käufl <golang@c.michael-kaeufl.de>
|
||||
Michael Lewis <mikelikespie@gmail.com>
|
||||
Michael MacInnis <Michael.P.MacInnis@gmail.com>
|
||||
Michael McConville <momcconville@gmail.com>
|
||||
Michael Pearson <mipearson@gmail.com>
|
||||
Michael Schaller <michael@5challer.de>
|
||||
Michael Stapelberg <michael@stapelberg.de>
|
||||
Michael Teichgräber <mteichgraeber@gmx.de>
|
||||
Michael Vetter <g.bluehut@gmail.com>
|
||||
Michal Bohuslávek <mbohuslavek@gmail.com>
|
||||
Michał Derkacz <ziutek@lnet.pl>
|
||||
Miek Gieben <miek@miek.nl>
|
||||
Miguel Mendez <stxmendez@gmail.com>
|
||||
Mihai Borobocea <MihaiBorobocea@gmail.com>
|
||||
Mikael Tillenius <mikti42@gmail.com>
|
||||
Mike Andrews <mra@xoba.com>
|
||||
Mike Appleby <mike@app.leby.org>
|
||||
Mike Houston <mike@kothar.net>
|
||||
Mike Rosset <mike.rosset@gmail.com>
|
||||
Mikhail Gusarov <dottedmag@dottedmag.net>
|
||||
Mikhail Panchenko <m@mihasya.com>
|
||||
Miki Tebeka <miki.tebeka@gmail.com>
|
||||
Mikio Hara <mikioh.mikioh@gmail.com>
|
||||
Mikkel Krautz <mikkel@krautz.dk>
|
||||
Miquel Sabaté Solà <mikisabate@gmail.com>
|
||||
Miroslav Genov <mgenov@gmail.com>
|
||||
Mohit Agarwal <mohit@sdf.org>
|
||||
Momchil Velikov <momchil.velikov@gmail.com>
|
||||
Monty Taylor <mordred@inaugust.com>
|
||||
Moov Corporation
|
||||
Moriyoshi Koizumi <mozo@mozo.jp>
|
||||
Morten Siebuhr <sbhr@sbhr.dk>
|
||||
Môshe van der Sterre <moshevds@gmail.com>
|
||||
Muhammed Uluyol <uluyol0@gmail.com>
|
||||
Nan Deng <monnand@gmail.com>
|
||||
Nathan John Youngman <nj@nathany.com>
|
||||
Nathan Otterness <otternes@cs.unc.edu>
|
||||
Nathan P Finch <nate.finch@gmail.com>
|
||||
Nathan VanBenschoten <nvanbenschoten@gmail.com>
|
||||
Nathan Youngman <git@nathany.com>
|
||||
Neelesh Chandola <neelesh.c98@gmail.com>
|
||||
Netflix, Inc.
|
||||
Nevins Bartolomeo <nevins.bartolomeo@gmail.com>
|
||||
ngmoco, LLC
|
||||
Niall Sheridan <nsheridan@gmail.com>
|
||||
Nic Day <nic.day@me.com>
|
||||
Nicholas Katsaros <nick@nickkatsaros.com>
|
||||
Nicholas Presta <nick@nickpresta.ca> <nick1presta@gmail.com>
|
||||
Nicholas Sullivan <nicholas.sullivan@gmail.com>
|
||||
Nicholas Waples <nwaples@gmail.com>
|
||||
Nick Craig-Wood <nick@craig-wood.com> <nickcw@gmail.com>
|
||||
Nick Leli <nicholasleli@gmail.com>
|
||||
Nick Patavalis <nick.patavalis@gmail.com>
|
||||
Nick Petroni <npetroni@cs.umd.edu>
|
||||
Nicolas Kaiser <nikai@nikai.net>
|
||||
Nicolas Owens <mischief@offblast.org>
|
||||
Nicolas S. Dade <nic.dade@gmail.com>
|
||||
Niels Widger <niels.widger@gmail.com>
|
||||
Nigel Kerr <nigel.kerr@gmail.com>
|
||||
Nik Nyby <nnyby@columbia.edu>
|
||||
Niko Dziemba <niko@dziemba.com>
|
||||
Nikolay Turpitko <nikolay@turpitko.com>
|
||||
Noah Campbell <noahcampbell@gmail.com>
|
||||
Norberto Lopes <nlopes.ml@gmail.com>
|
||||
Odin Ugedal <odin@ugedal.com>
|
||||
Oleg Vakheta <helginet@gmail.com>
|
||||
Oleku Konko <oleku.konko@gmail.com>
|
||||
Oling Cat <olingcat@gmail.com>
|
||||
Oliver Hookins <ohookins@gmail.com>
|
||||
Olivier Antoine <olivier.antoine@gmail.com>
|
||||
Olivier Duperray <duperray.olivier@gmail.com>
|
||||
Olivier Poitrey <rs@dailymotion.com>
|
||||
Olivier Saingre <osaingre@gmail.com>
|
||||
Oracle
|
||||
Orange
|
||||
Özgür Kesim <oec-go@kesim.org>
|
||||
Padraig Kitterick <padraigkitterick@gmail.com>
|
||||
Palm Stone Games
|
||||
Paolo Giarrusso <p.giarrusso@gmail.com>
|
||||
Paolo Martini <mrtnpaolo@gmail.com>
|
||||
Parker Moore <parkrmoore@gmail.com>
|
||||
Pascal S. de Kloe <pascal@quies.net>
|
||||
Patrick Crosby <patrick@stathat.com>
|
||||
Patrick Gavlin <pgavlin@gmail.com>
|
||||
Patrick Higgins <patrick.allen.higgins@gmail.com>
|
||||
Patrick Lee <pattyshack101@gmail.com>
|
||||
Patrick Mézard <patrick@mezard.eu>
|
||||
Patrick Mylund Nielsen <patrick@patrickmn.com>
|
||||
Patrick Smith <pat42smith@gmail.com>
|
||||
Paul A Querna <paul.querna@gmail.com>
|
||||
Paul Hammond <paul@paulhammond.org>
|
||||
Paul Lalonde <paul.a.lalonde@gmail.com>
|
||||
Paul Meyer <paul.meyer@microsoft.com>
|
||||
Paul Rosania <paul.rosania@gmail.com>
|
||||
Paul Sbarra <Sbarra.Paul@gmail.com>
|
||||
Paul Smith <paulsmith@pobox.com> <paulsmith@gmail.com>
|
||||
Paul van Brouwershaven <paul@vanbrouwershaven.com>
|
||||
Paulo Casaretto <pcasaretto@gmail.com>
|
||||
Pavel Paulau <pavel.paulau@gmail.com>
|
||||
Pavel Zinovkin <pavel.zinovkin@gmail.com>
|
||||
Pawel Knap <pawelknap88@gmail.com>
|
||||
Percy Wegmann <ox.to.a.cart@gmail.com>
|
||||
Perry Abbott <perry.j.abbott@gmail.com>
|
||||
Petar Maymounkov <petarm@gmail.com>
|
||||
Peter Armitage <peter.armitage@gmail.com>
|
||||
Peter Froehlich <peter.hans.froehlich@gmail.com>
|
||||
Peter Kleiweg <pkleiweg@xs4all.nl>
|
||||
Peter Moody <pmoody@uber.com>
|
||||
Peter Mundy <go.peter.90@gmail.com>
|
||||
Péter Surányi <speter.go1@gmail.com>
|
||||
Péter Szilágyi <peterke@gmail.com>
|
||||
Peter Waldschmidt <peter@waldschmidt.com>
|
||||
Peter Waller <peter.waller@gmail.com>
|
||||
Peter Williams <pwil3058@gmail.com>
|
||||
Philip Børgesen <philip.borgesen@gmail.com>
|
||||
Philip Hofer <phofer@umich.edu>
|
||||
Philip K. Warren <pkwarren@gmail.com>
|
||||
Pierre Durand <pierredurand@gmail.com>
|
||||
Pierre Roullon <pierre.roullon@gmail.com>
|
||||
Pieter Droogendijk <pieter@binky.org.uk>
|
||||
Pietro Gagliardi <pietro10@mac.com>
|
||||
Prashant Varanasi <prashant@prashantv.com>
|
||||
Preetam Jinka <pj@preet.am>
|
||||
Quan Tran <qeed.quan@gmail.com>
|
||||
Quan Yong Zhai <qyzhai@gmail.com>
|
||||
Quentin Perez <qperez@ocs.online.net>
|
||||
Quoc-Viet Nguyen <afelion@gmail.com>
|
||||
RackTop Systems Inc.
|
||||
Radu Berinde <radu@cockroachlabs.com>
|
||||
Rafal Jeczalik <rjeczalik@gmail.com>
|
||||
Raif S. Naffah <go@naffah-raif.name>
|
||||
Rajat Goel <rajat.goel2010@gmail.com>
|
||||
Ralph Corderoy <ralph@inputplus.co.uk>
|
||||
Raphael Geronimi <raphael.geronimi@gmail.com>
|
||||
Red Hat, Inc.
|
||||
Reinaldo de Souza Jr <juniorz@gmail.com>
|
||||
Rémy Oudompheng <oudomphe@phare.normalesup.org>
|
||||
Ricardo Padilha <ricardospadilha@gmail.com>
|
||||
Richard Barnes <rlb@ipv.sx>
|
||||
Richard Crowley <r@rcrowley.org>
|
||||
Richard Eric Gavaletz <gavaletz@gmail.com>
|
||||
Richard Gibson <richard.gibson@gmail.com>
|
||||
Richard Miller <miller.research@gmail.com>
|
||||
Richard Musiol <mail@richard-musiol.de>
|
||||
Rick Arnold <rickarnoldjr@gmail.com>
|
||||
Risto Jaakko Saarelma <rsaarelm@gmail.com>
|
||||
Rob Norman <rob.norman@infinitycloud.com>
|
||||
Robert Daniel Kortschak <dan.kortschak@adelaide.edu.au>
|
||||
Robert Dinu <r@varp.se>
|
||||
Robert Figueiredo <robfig@gmail.com>
|
||||
Robert Hencke <robert.hencke@gmail.com>
|
||||
Robert Obryk <robryk@gmail.com>
|
||||
Robert Stepanek <robert.stepanek@gmail.com>
|
||||
Robin Eklind <r.eklind.87@gmail.com>
|
||||
Rodrigo Moraes de Oliveira <rodrigo.moraes@gmail.com>
|
||||
Rodrigo Rafael Monti Kochenburger <divoxx@gmail.com>
|
||||
Roger Pau Monné <royger@gmail.com>
|
||||
Roger Peppe <rogpeppe@gmail.com>
|
||||
Roland Shoemaker <rolandshoemaker@gmail.com>
|
||||
Ron Hashimoto <mail@h2so5.net>
|
||||
Ron Minnich <rminnich@gmail.com>
|
||||
Ross Light <rlight2@gmail.com>
|
||||
Rowan Worth <sqweek@gmail.com>
|
||||
Russell Haering <russellhaering@gmail.com>
|
||||
Ryan Bagwell <ryanbagwell@outlook.com>
|
||||
Ryan Hitchman <hitchmanr@gmail.com>
|
||||
Ryan Lower <rpjlower@gmail.com>
|
||||
Ryan Seys <ryan@ryanseys.com>
|
||||
Ryan Slade <ryanslade@gmail.com>
|
||||
Ryuzo Yamamoto <ryuzo.yamamoto@gmail.com>
|
||||
S.Çağlar Onur <caglar@10ur.org>
|
||||
Salmān Aljammāz <s@0x65.net>
|
||||
Sam Hug <samuel.b.hug@gmail.com>
|
||||
Sam Whited <sam@samwhited.com>
|
||||
Samuele Pedroni <pedronis@lucediurna.net>
|
||||
Sanjay Menakuru <balasanjay@gmail.com>
|
||||
Sasha Sobol <sasha@scaledinference.com>
|
||||
Scott Barron <scott.barron@github.com>
|
||||
Scott Bell <scott@sctsm.com>
|
||||
Scott Ferguson <scottwferg@gmail.com>
|
||||
Scott Lawrence <bytbox@gmail.com>
|
||||
Sean Rees <sean@erifax.org>
|
||||
Sebastien Binet <seb.binet@gmail.com>
|
||||
Sébastien Paolacci <sebastien.paolacci@gmail.com>
|
||||
Sebastien Binet <seb.binet@gmail.com>
|
||||
Sergei Skorobogatov <skorobo@rambler.ru>
|
||||
Sergey 'SnakE' Gromov <snake.scaly@gmail.com>
|
||||
Sergio Luis O. B. Correia <sergio@correia.cc>
|
||||
Seth Hoenig <seth.a.hoenig@gmail.com>
|
||||
Seth Vargo <sethvargo@gmail.com>
|
||||
Shahar Kohanim <skohanim@gmail.com>
|
||||
Shane Hansen <shanemhansen@gmail.com>
|
||||
Shaozhen Ding <dsz0111@gmail.com>
|
||||
Shawn Smith <shawn.p.smith@gmail.com>
|
||||
Shenghou Ma <minux.ma@gmail.com>
|
||||
Shinji Tanaka <shinji.tanaka@gmail.com>
|
||||
Shivakumar GN <shivakumar.gn@gmail.com>
|
||||
Silvan Jegen <s.jegen@gmail.com>
|
||||
Simon Jefford <simon.jefford@gmail.com>
|
||||
Simon Rawet <simon@rawet.se>
|
||||
Simon Thulbourn <simon+github@thulbourn.com>
|
||||
Simon Whitehead <chemnova@gmail.com>
|
||||
Sina Siadat <siadat@gmail.com>
|
||||
Sokolov Yura <funny.falcon@gmail.com>
|
||||
Song Gao <song@gao.io>
|
||||
Sourcegraph Inc
|
||||
Spencer Nelson <s@spenczar.com>
|
||||
Sergio Luis O. B. Correia <sergio@larces.uece.br>
|
||||
Spring Mc <heresy.mc@gmail.com>
|
||||
Square, Inc.
|
||||
Sridhar Venkatakrishnan <sridhar@laddoo.net>
|
||||
StalkR <stalkr@stalkr.net>
|
||||
Stan Schwertly <stan@schwertly.com>
|
||||
Stefan Nilsson <snilsson@nada.kth.se> <trolleriprofessorn@gmail.com>
|
||||
Stéphane Travostino <stephane.travostino@gmail.com>
|
||||
Stephen McQuay <stephen@mcquay.me>
|
||||
Stefan Nilsson <snilsson@nada.kth.se>
|
||||
Stephen Weinberg <stephen@q5comm.com>
|
||||
Steve McCoy <mccoyst@gmail.com>
|
||||
Steve Phillips <elimisteve@gmail.com>
|
||||
Steve Streeting <steve@stevestreeting.com>
|
||||
Steven Elliot Harris <seharris@gmail.com>
|
||||
Steven Hartland <steven.hartland@multiplay.co.uk>
|
||||
Stripe, Inc.
|
||||
Suyash <dextrous93@gmail.com>
|
||||
Sven Almgren <sven@tras.se>
|
||||
Syohei YOSHIDA <syohex@gmail.com>
|
||||
Szabolcs Nagy <nsz@port70.net>
|
||||
Tad Glines <tad.glines@gmail.com>
|
||||
Taj Khattra <taj.khattra@gmail.com>
|
||||
Takeshi YAMANASHI <9.nashi@gmail.com>
|
||||
Takuya Ueda <uedatakuya@gmail.com>
|
||||
Tal Shprecher <tshprecher@gmail.com>
|
||||
Tamir Duberstein <tamird@gmail.com>
|
||||
Tarmigan Casebolt <tarmigan@gmail.com>
|
||||
Taru Karttunen <taruti@taruti.net>
|
||||
Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
|
||||
Terrel Shumway <gopher@shumway.us>
|
||||
Tetsuo Kiso <tetsuokiso9@gmail.com>
|
||||
Thiago Fransosi Farina <thiago.farina@gmail.com>
|
||||
Thomas Alan Copeland <talan.copeland@gmail.com>
|
||||
Thomas de Zeeuw <thomasdezeeuw@gmail.com>
|
||||
Thomas Desrosiers <thomasdesr@gmail.com>
|
||||
Thomas Kappler <tkappler@gmail.com>
|
||||
Thorben Krueger <thorben.krueger@gmail.com>
|
||||
Thordur Bjornsson <thorduri@secnorth.net>
|
||||
Tilman Dilo <tilman.dilo@gmail.com>
|
||||
Tim Cooijmans <timcooijmans@gmail.com>
|
||||
Tim Ebringer <tim.ebringer@gmail.com>
|
||||
Tim Henderson <tim.tadh@gmail.com>
|
||||
Timo Savola <timo.savola@gmail.com>
|
||||
Timo Truyts <alkaloid.btx@gmail.com>
|
||||
Timothy Studd <tim@timstudd.com>
|
||||
Tobias Columbus <tobias.columbus@gmail.com>
|
||||
Todd Neal <todd@tneal.org>
|
||||
Tom Heng <zhm20070928@gmail.com>
|
||||
Tom Linford <tomlinford@gmail.com>
|
||||
Tommy Schaefer <tommy.schaefer@teecom.com>
|
||||
Tor Andersson <tor.andersson@gmail.com>
|
||||
Tormod Erevik Lea <tormodlea@gmail.com>
|
||||
Totoro W <tw19881113@gmail.com>
|
||||
Travis Cline <travis.cline@gmail.com>
|
||||
Trey Lawrence <lawrence.trey@gmail.com>
|
||||
Trey Tacon <ttacon@gmail.com>
|
||||
Tristan Colgate <tcolgate@gmail.com>
|
||||
Tristan Ooohry <ooohry@gmail.com>
|
||||
Tudor Golubenco <tudor.g@gmail.com>
|
||||
Tuo Shan <sturbo89@gmail.com>
|
||||
Tyler Bunnell <tylerbunnell@gmail.com>
|
||||
Tyler Treat <ttreat31@gmail.com>
|
||||
Ugorji Nwoke <ugorji@gmail.com>
|
||||
Ulf Holm Nielsen <doktor@dyregod.dk>
|
||||
Ulrich Kunitz <uli.kunitz@gmail.com>
|
||||
Upthere, Inc.
|
||||
Uriel Mangado <uriel@berlinblue.org>
|
||||
Vadim Grek <vadimprog@gmail.com>
|
||||
Vadim Vygonets <unixdj@gmail.com>
|
||||
Vendasta
|
||||
Vincent Ambo <tazjin@googlemail.com>
|
||||
Vincent Batts <vbatts@hashbangbash.com> <vbatts@gmail.com>
|
||||
Vincent Vanackere <vincent.vanackere@gmail.com>
|
||||
Vinu Rajashekhar <vinutheraj@gmail.com>
|
||||
Vishvananda Ishaya <vishvananda@gmail.com>
|
||||
Vitor De Mario <vitordemario@gmail.com>
|
||||
Vladimir Mihailenco <vladimir.webdev@gmail.com>
|
||||
Vladimir Nikishenko <vova616@gmail.com>
|
||||
Vladimir Stefanovic <vladimir.stefanovic@imgtec.com>
|
||||
Volker Dobler <dr.volker.dobler@gmail.com>
|
||||
Weaveworks
|
||||
Wei Guangjing <vcc.163@gmail.com>
|
||||
Willem van der Schyff <willemvds@gmail.com>
|
||||
William Josephson <wjosephson@gmail.com>
|
||||
William Orr <will@worrbase.com> <ay1244@gmail.com>
|
||||
Wisdom Omuya <deafgoat@gmail.com>
|
||||
Xia Bin <snyh@snyh.org>
|
||||
Xing Xing <mikespook@gmail.com>
|
||||
Xudong Zhang <felixmelon@gmail.com>
|
||||
Xuyang Kang <xuyangkang@gmail.com>
|
||||
Yahoo Inc.
|
||||
Yann Kerhervé <yann.kerherve@gmail.com>
|
||||
Yao Zhang <lunaria21@gmail.com>
|
||||
Yasuharu Goto <matope.ono@gmail.com>
|
||||
Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
Yesudeep Mangalapilly <yesudeep@google.com>
|
||||
Yissakhar Z. Beck <yissakhar.beck@gmail.com>
|
||||
Yo-An Lin <yoanlin93@gmail.com>
|
||||
Yongjian Xu <i3dmaster@gmail.com>
|
||||
Yorman Arias <cixtords@gmail.com>
|
||||
Yoshiyuki Kanno <nekotaroh@gmail.com> <yoshiyuki.kanno@stoic.co.jp>
|
||||
Yusuke Kagiwada <block.rxckin.beats@gmail.com>
|
||||
Yuusei Kuwana <kuwana@kumama.org>
|
||||
Yuval Pavel Zholkover <paulzhol@gmail.com>
|
||||
Zac Bergquist <zbergquist99@gmail.com>
|
||||
Zemanta d.o.o.
|
||||
Zev Goldstein <zev.goldstein@gmail.com>
|
||||
Ziad Hatahet <hatahet@gmail.com>
|
||||
Zorion Arrizabalaga <zorionk@gmail.com>
|
||||
Фахриддин Балтаев <faxriddinjon@gmail.com>
|
||||
申习之 <bronze1man@gmail.com>
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# Contributing to Go
|
||||
|
||||
Go is an open source project.
|
||||
|
||||
It is the work of hundreds of contributors. We appreciate your help!
|
||||
|
||||
|
||||
## Filing issues
|
||||
|
||||
General questions should go to the
|
||||
[golang-nuts mailing list](https://groups.google.com/group/golang-nuts) or
|
||||
[other forum](https://golang.org/wiki/Questions) instead of the issue tracker.
|
||||
The gophers there will answer or ask you to file an issue if you've tripped over a bug.
|
||||
|
||||
When filing an issue, make sure to answer these five questions:
|
||||
|
||||
1. What version of Go are you using (`go version`)?
|
||||
2. What operating system and processor architecture are you using?
|
||||
3. What did you do?
|
||||
4. What did you expect to see?
|
||||
5. What did you see instead?
|
||||
|
||||
For change proposals, see [Proposing Changes To Go](https://github.com/golang/proposal/).
|
||||
|
||||
Sensitive security-related issues should be reported to [security@golang.org](mailto:security@golang.org).
|
||||
|
||||
## Contributing code
|
||||
|
||||
Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html)
|
||||
before sending patches.
|
||||
|
||||
**We do not accept GitHub pull requests**
|
||||
(we use [an instance](https://go-review.googlesource.com/) of the
|
||||
[Gerrit](https://www.gerritcodereview.com/) code review system instead).
|
||||
Also, please do not post patches on the issue tracker.
|
||||
|
||||
Unless otherwise noted, the Go source files are distributed under
|
||||
the BSD-style license found in the LICENSE file.
|
||||
|
||||
1005
CONTRIBUTORS
1005
CONTRIBUTORS
File diff suppressed because it is too large
Load Diff
31
README
Normal file
31
README
Normal file
@@ -0,0 +1,31 @@
|
||||
This is the source code repository for the Go programming language.
|
||||
|
||||
For documentation about how to install and use Go,
|
||||
visit http://golang.org/ or load doc/install.html in your web browser.
|
||||
|
||||
After installing Go, you can view a nicely formatted
|
||||
doc/install.html by running godoc --http=:6060
|
||||
and then visiting http://localhost:6060/doc/install.html.
|
||||
|
||||
Unless otherwise noted, the Go source files are distributed
|
||||
under the BSD-style license found in the LICENSE file.
|
||||
|
||||
--
|
||||
|
||||
Binary Distribution Notes
|
||||
|
||||
If you have just untarred a binary Go distribution, you need to set
|
||||
the environment variable $GOROOT to the full path of the go
|
||||
directory (the one containing this README). You can omit the
|
||||
variable if you unpack it into /usr/local/go, or if you rebuild
|
||||
from sources by running all.bash (see doc/install.html).
|
||||
You should also add the Go binary directory $GOROOT/bin
|
||||
to your shell's path.
|
||||
|
||||
For example, if you extracted the tar file into $HOME/go, you might
|
||||
put the following in your .profile:
|
||||
|
||||
export GOROOT=$HOME/go
|
||||
export PATH=$PATH:$GOROOT/bin
|
||||
|
||||
See doc/install.html for more details.
|
||||
41
README.md
41
README.md
@@ -1,41 +0,0 @@
|
||||
# The Go Programming Language
|
||||
|
||||
Go is an open source programming language that makes it easy to build simple,
|
||||
reliable, and efficient software.
|
||||
|
||||

|
||||
|
||||
Our canonical Git repository is located at https://go.googlesource.com/go.
|
||||
There is a mirror of the repository at https://github.com/golang/go.
|
||||
|
||||
Unless otherwise noted, the Go source files are distributed under the
|
||||
BSD-style license found in the LICENSE file.
|
||||
|
||||
### Download and Install
|
||||
|
||||
#### Binary Distributions
|
||||
|
||||
Official binary distributions are available at https://golang.org/dl/.
|
||||
|
||||
After downloading a binary release, visit https://golang.org/doc/install
|
||||
or load doc/install.html in your web browser for installation
|
||||
instructions.
|
||||
|
||||
#### Install From Source
|
||||
|
||||
If a binary distribution is not available for your combination of
|
||||
operating system and architecture, visit
|
||||
https://golang.org/doc/install/source or load doc/install-source.html
|
||||
in your web browser for source installation instructions.
|
||||
|
||||
### Contributing
|
||||
|
||||
Go is the work of hundreds of contributors. We appreciate your help!
|
||||
|
||||
To contribute, please read the contribution guidelines:
|
||||
https://golang.org/doc/contribute.html
|
||||
|
||||
Note that the Go project does not use GitHub pull requests, and that
|
||||
we use the issue tracker for bug reports and proposals only. See
|
||||
https://golang.org/wiki/Questions for a list of places to ask
|
||||
questions about the Go language.
|
||||
14
api/README
14
api/README
@@ -1,14 +0,0 @@
|
||||
Files in this directory are data for Go's API checker ("go tool api", in src/cmd/api).
|
||||
|
||||
Each file is a list of API features, one per line.
|
||||
|
||||
go1.txt (and similarly named files) are frozen once a version has been
|
||||
shipped. Each file adds new lines but does not remove any.
|
||||
|
||||
except.txt lists features that may disappear without breaking true
|
||||
compatibility.
|
||||
|
||||
next.txt is the only file intended to be mutated. It's a list of
|
||||
features that may be added to the next version. It only affects
|
||||
warning output from the go api tool.
|
||||
|
||||
344
api/except.txt
344
api/except.txt
@@ -1,344 +0,0 @@
|
||||
pkg encoding/json, method (*RawMessage) MarshalJSON() ([]uint8, error)
|
||||
pkg net, func ListenUnixgram(string, *UnixAddr) (*UDPConn, error)
|
||||
pkg os (linux-arm), const O_SYNC = 4096
|
||||
pkg os (linux-arm-cgo), const O_SYNC = 4096
|
||||
pkg syscall (darwin-386), const ImplementsGetwd = false
|
||||
pkg syscall (darwin-386), func Fchflags(string, int) error
|
||||
pkg syscall (darwin-386-cgo), const ImplementsGetwd = false
|
||||
pkg syscall (darwin-386-cgo), func Fchflags(string, int) error
|
||||
pkg syscall (darwin-amd64), const ImplementsGetwd = false
|
||||
pkg syscall (darwin-amd64), func Fchflags(string, int) error
|
||||
pkg syscall (darwin-amd64-cgo), const ImplementsGetwd = false
|
||||
pkg syscall (darwin-amd64-cgo), func Fchflags(string, int) error
|
||||
pkg syscall (freebsd-386), const AF_MAX = 38
|
||||
pkg syscall (freebsd-386), const DLT_MATCHING_MAX = 242
|
||||
pkg syscall (freebsd-386), const ELAST = 94
|
||||
pkg syscall (freebsd-386), const O_CLOEXEC = 0
|
||||
pkg syscall (freebsd-386), func Fchflags(string, int) error
|
||||
pkg syscall (freebsd-386-cgo), const AF_MAX = 38
|
||||
pkg syscall (freebsd-386-cgo), const DLT_MATCHING_MAX = 242
|
||||
pkg syscall (freebsd-386-cgo), const ELAST = 94
|
||||
pkg syscall (freebsd-386-cgo), const O_CLOEXEC = 0
|
||||
pkg syscall (freebsd-amd64), const AF_MAX = 38
|
||||
pkg syscall (freebsd-amd64), const DLT_MATCHING_MAX = 242
|
||||
pkg syscall (freebsd-amd64), const ELAST = 94
|
||||
pkg syscall (freebsd-amd64), const O_CLOEXEC = 0
|
||||
pkg syscall (freebsd-amd64), func Fchflags(string, int) error
|
||||
pkg syscall (freebsd-amd64-cgo), const AF_MAX = 38
|
||||
pkg syscall (freebsd-amd64-cgo), const DLT_MATCHING_MAX = 242
|
||||
pkg syscall (freebsd-amd64-cgo), const ELAST = 94
|
||||
pkg syscall (freebsd-amd64-cgo), const O_CLOEXEC = 0
|
||||
pkg syscall (freebsd-arm), const AF_MAX = 38
|
||||
pkg syscall (freebsd-arm), const BIOCGRTIMEOUT = 1074545262
|
||||
pkg syscall (freebsd-arm), const BIOCSRTIMEOUT = 2148287085
|
||||
pkg syscall (freebsd-arm), const ELAST = 94
|
||||
pkg syscall (freebsd-arm), const O_CLOEXEC = 0
|
||||
pkg syscall (freebsd-arm), const SIOCAIFADDR = 2151967019
|
||||
pkg syscall (freebsd-arm), const SIOCGIFSTATUS = 3274991931
|
||||
pkg syscall (freebsd-arm), const SIOCSIFPHYADDR = 2151967046
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_FCNTLS_GET = 537
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_FCNTLS_GET ideal-int
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_FCNTLS_LIMIT = 536
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_FCNTLS_LIMIT ideal-int
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_IOCTLS_GET = 535
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_IOCTLS_GET ideal-int
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_IOCTLS_LIMIT = 534
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_IOCTLS_LIMIT ideal-int
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_RIGHTS_GET = 515
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_RIGHTS_GET ideal-int
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_RIGHTS_LIMIT = 533
|
||||
pkg syscall (freebsd-arm), const SYS_CAP_RIGHTS_LIMIT ideal-int
|
||||
pkg syscall (freebsd-arm), const SizeofBpfHdr = 24
|
||||
pkg syscall (freebsd-arm), const SizeofIfData = 88
|
||||
pkg syscall (freebsd-arm), const SizeofIfMsghdr = 104
|
||||
pkg syscall (freebsd-arm), const SizeofSockaddrDatalink = 56
|
||||
pkg syscall (freebsd-arm), const SizeofSockaddrUnix = 108
|
||||
pkg syscall (freebsd-arm), const TIOCTIMESTAMP = 1074558041
|
||||
pkg syscall (freebsd-arm), func Fchflags(string, int) error
|
||||
pkg syscall (freebsd-arm), type BpfHdr struct, Pad_cgo_0 [2]uint8
|
||||
pkg syscall (freebsd-arm), type RawSockaddrDatalink struct, Pad_cgo_0 [2]uint8
|
||||
pkg syscall (freebsd-arm), type RawSockaddrUnix struct, Pad_cgo_0 [2]uint8
|
||||
pkg syscall (freebsd-arm), type Stat_t struct, Pad_cgo_0 [4]uint8
|
||||
pkg syscall (freebsd-arm-cgo), const AF_MAX = 38
|
||||
pkg syscall (freebsd-arm-cgo), const BIOCGRTIMEOUT = 1074545262
|
||||
pkg syscall (freebsd-arm-cgo), const BIOCSRTIMEOUT = 2148287085
|
||||
pkg syscall (freebsd-arm-cgo), const ELAST = 94
|
||||
pkg syscall (freebsd-arm-cgo), const O_CLOEXEC = 0
|
||||
pkg syscall (freebsd-arm-cgo), const SIOCAIFADDR = 2151967019
|
||||
pkg syscall (freebsd-arm-cgo), const SIOCGIFSTATUS = 3274991931
|
||||
pkg syscall (freebsd-arm-cgo), const SIOCSIFPHYADDR = 2151967046
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_FCNTLS_GET = 537
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_FCNTLS_GET ideal-int
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_FCNTLS_LIMIT = 536
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_FCNTLS_LIMIT ideal-int
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_IOCTLS_GET = 535
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_IOCTLS_GET ideal-int
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_IOCTLS_LIMIT = 534
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_IOCTLS_LIMIT ideal-int
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_RIGHTS_GET = 515
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_RIGHTS_GET ideal-int
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_RIGHTS_LIMIT = 533
|
||||
pkg syscall (freebsd-arm-cgo), const SYS_CAP_RIGHTS_LIMIT ideal-int
|
||||
pkg syscall (freebsd-arm-cgo), const SizeofBpfHdr = 24
|
||||
pkg syscall (freebsd-arm-cgo), const SizeofIfData = 88
|
||||
pkg syscall (freebsd-arm-cgo), const SizeofIfMsghdr = 104
|
||||
pkg syscall (freebsd-arm-cgo), const SizeofSockaddrDatalink = 56
|
||||
pkg syscall (freebsd-arm-cgo), const SizeofSockaddrUnix = 108
|
||||
pkg syscall (freebsd-arm-cgo), const TIOCTIMESTAMP = 1074558041
|
||||
pkg syscall (freebsd-arm-cgo), func Fchflags(string, int) error
|
||||
pkg syscall (freebsd-arm-cgo), type BpfHdr struct, Pad_cgo_0 [2]uint8
|
||||
pkg syscall (freebsd-arm-cgo), type RawSockaddrDatalink struct, Pad_cgo_0 [2]uint8
|
||||
pkg syscall (freebsd-arm-cgo), type RawSockaddrUnix struct, Pad_cgo_0 [2]uint8
|
||||
pkg syscall (freebsd-arm-cgo), type Stat_t struct, Pad_cgo_0 [4]uint8
|
||||
pkg syscall (linux-386), type Cmsghdr struct, X__cmsg_data [0]uint8
|
||||
pkg syscall (linux-386-cgo), type Cmsghdr struct, X__cmsg_data [0]uint8
|
||||
pkg syscall (linux-amd64), type Cmsghdr struct, X__cmsg_data [0]uint8
|
||||
pkg syscall (linux-amd64-cgo), type Cmsghdr struct, X__cmsg_data [0]uint8
|
||||
pkg syscall (linux-arm), type Cmsghdr struct, X__cmsg_data [0]uint8
|
||||
pkg syscall (linux-arm-cgo), type Cmsghdr struct, X__cmsg_data [0]uint8
|
||||
pkg syscall (netbsd-arm), const SizeofIfData = 132
|
||||
pkg syscall (netbsd-arm), func Fchflags(string, int) error
|
||||
pkg syscall (netbsd-arm), type IfMsghdr struct, Pad_cgo_1 [4]uint8
|
||||
pkg syscall (netbsd-arm-cgo), const SizeofIfData = 132
|
||||
pkg syscall (netbsd-arm-cgo), func Fchflags(string, int) error
|
||||
pkg syscall (netbsd-arm-cgo), type IfMsghdr struct, Pad_cgo_1 [4]uint8
|
||||
pkg syscall (openbsd-386), const BIOCGRTIMEOUT = 1074283118
|
||||
pkg syscall (openbsd-386), const BIOCSRTIMEOUT = 2148024941
|
||||
pkg syscall (openbsd-386), const RTF_FMASK = 63496
|
||||
pkg syscall (openbsd-386), const RTM_VERSION = 4
|
||||
pkg syscall (openbsd-386), const SIOCBRDGDADDR = 2150132039
|
||||
pkg syscall (openbsd-386), const SIOCBRDGGPARAM = 3224922456
|
||||
pkg syscall (openbsd-386), const SIOCBRDGSADDR = 3223873860
|
||||
pkg syscall (openbsd-386), const SYS_CLOCK_GETRES = 234
|
||||
pkg syscall (openbsd-386), const SYS_CLOCK_GETTIME = 232
|
||||
pkg syscall (openbsd-386), const SYS_CLOCK_SETTIME = 233
|
||||
pkg syscall (openbsd-386), const SYS_FHSTATFS = 309
|
||||
pkg syscall (openbsd-386), const SYS_FSTAT = 292
|
||||
pkg syscall (openbsd-386), const SYS_FSTATAT = 316
|
||||
pkg syscall (openbsd-386), const SYS_FSTATFS = 308
|
||||
pkg syscall (openbsd-386), const SYS_FUTIMENS = 327
|
||||
pkg syscall (openbsd-386), const SYS_FUTIMES = 206
|
||||
pkg syscall (openbsd-386), const SYS_GETDIRENTRIES = 312
|
||||
pkg syscall (openbsd-386), const SYS_GETDIRENTRIES ideal-int
|
||||
pkg syscall (openbsd-386), const SYS_GETFSSTAT = 306
|
||||
pkg syscall (openbsd-386), const SYS_GETITIMER = 86
|
||||
pkg syscall (openbsd-386), const SYS_GETRUSAGE = 117
|
||||
pkg syscall (openbsd-386), const SYS_GETTIMEOFDAY = 116
|
||||
pkg syscall (openbsd-386), const SYS_KEVENT = 270
|
||||
pkg syscall (openbsd-386), const SYS_LSTAT = 293
|
||||
pkg syscall (openbsd-386), const SYS_NANOSLEEP = 240
|
||||
pkg syscall (openbsd-386), const SYS_SELECT = 93
|
||||
pkg syscall (openbsd-386), const SYS_SETITIMER = 83
|
||||
pkg syscall (openbsd-386), const SYS_SETTIMEOFDAY = 122
|
||||
pkg syscall (openbsd-386), const SYS_STAT = 291
|
||||
pkg syscall (openbsd-386), const SYS_STATFS = 307
|
||||
pkg syscall (openbsd-386), const SYS_UTIMENSAT = 326
|
||||
pkg syscall (openbsd-386), const SYS_UTIMES = 138
|
||||
pkg syscall (openbsd-386), const SYS_WAIT4 = 7
|
||||
pkg syscall (openbsd-386), const SYS___THRSLEEP = 300
|
||||
pkg syscall (openbsd-386), const SizeofIfData = 208
|
||||
pkg syscall (openbsd-386), const SizeofIfMsghdr = 232
|
||||
pkg syscall (openbsd-386), const SizeofRtMetrics = 48
|
||||
pkg syscall (openbsd-386), const SizeofRtMsghdr = 88
|
||||
pkg syscall (openbsd-386), const TIOCGTSTAMP = 1074295899
|
||||
pkg syscall (openbsd-386), type Dirent struct, Fileno uint32
|
||||
pkg syscall (openbsd-386), type FdSet struct, Bits [32]int32
|
||||
pkg syscall (openbsd-386), type Kevent_t struct, Data int32
|
||||
pkg syscall (openbsd-386), type Mclpool struct, Grown uint32
|
||||
pkg syscall (openbsd-386), type RtMetrics struct, Expire uint32
|
||||
pkg syscall (openbsd-386), type Stat_t struct, Ino uint32
|
||||
pkg syscall (openbsd-386), type Stat_t struct, Lspare0 int32
|
||||
pkg syscall (openbsd-386), type Stat_t struct, Lspare1 int32
|
||||
pkg syscall (openbsd-386), type Stat_t struct, Qspare [2]int64
|
||||
pkg syscall (openbsd-386), type Statfs_t struct, F_ctime uint32
|
||||
pkg syscall (openbsd-386), type Statfs_t struct, F_spare [3]uint32
|
||||
pkg syscall (openbsd-386), type Timespec struct, Sec int32
|
||||
pkg syscall (openbsd-386), type Timeval struct, Sec int32
|
||||
pkg syscall (openbsd-386-cgo), const BIOCGRTIMEOUT = 1074283118
|
||||
pkg syscall (openbsd-386-cgo), const BIOCSRTIMEOUT = 2148024941
|
||||
pkg syscall (openbsd-386-cgo), const RTF_FMASK = 63496
|
||||
pkg syscall (openbsd-386-cgo), const RTM_VERSION = 4
|
||||
pkg syscall (openbsd-386-cgo), const SIOCBRDGDADDR = 2150132039
|
||||
pkg syscall (openbsd-386-cgo), const SIOCBRDGGPARAM = 3224922456
|
||||
pkg syscall (openbsd-386-cgo), const SIOCBRDGSADDR = 3223873860
|
||||
pkg syscall (openbsd-386-cgo), const SYS_CLOCK_GETRES = 234
|
||||
pkg syscall (openbsd-386-cgo), const SYS_CLOCK_GETTIME = 232
|
||||
pkg syscall (openbsd-386-cgo), const SYS_CLOCK_SETTIME = 233
|
||||
pkg syscall (openbsd-386-cgo), const SYS_FHSTATFS = 309
|
||||
pkg syscall (openbsd-386-cgo), const SYS_FSTAT = 292
|
||||
pkg syscall (openbsd-386-cgo), const SYS_FSTATAT = 316
|
||||
pkg syscall (openbsd-386-cgo), const SYS_FSTATFS = 308
|
||||
pkg syscall (openbsd-386-cgo), const SYS_FUTIMENS = 327
|
||||
pkg syscall (openbsd-386-cgo), const SYS_FUTIMES = 206
|
||||
pkg syscall (openbsd-386-cgo), const SYS_GETDIRENTRIES = 312
|
||||
pkg syscall (openbsd-386-cgo), const SYS_GETDIRENTRIES ideal-int
|
||||
pkg syscall (openbsd-386-cgo), const SYS_GETFSSTAT = 306
|
||||
pkg syscall (openbsd-386-cgo), const SYS_GETITIMER = 86
|
||||
pkg syscall (openbsd-386-cgo), const SYS_GETRUSAGE = 117
|
||||
pkg syscall (openbsd-386-cgo), const SYS_GETTIMEOFDAY = 116
|
||||
pkg syscall (openbsd-386-cgo), const SYS_KEVENT = 270
|
||||
pkg syscall (openbsd-386-cgo), const SYS_LSTAT = 293
|
||||
pkg syscall (openbsd-386-cgo), const SYS_NANOSLEEP = 240
|
||||
pkg syscall (openbsd-386-cgo), const SYS_SELECT = 93
|
||||
pkg syscall (openbsd-386-cgo), const SYS_SETITIMER = 83
|
||||
pkg syscall (openbsd-386-cgo), const SYS_SETTIMEOFDAY = 122
|
||||
pkg syscall (openbsd-386-cgo), const SYS_STAT = 291
|
||||
pkg syscall (openbsd-386-cgo), const SYS_STATFS = 307
|
||||
pkg syscall (openbsd-386-cgo), const SYS_UTIMENSAT = 326
|
||||
pkg syscall (openbsd-386-cgo), const SYS_UTIMES = 138
|
||||
pkg syscall (openbsd-386-cgo), const SYS_WAIT4 = 7
|
||||
pkg syscall (openbsd-386-cgo), const SYS___THRSLEEP = 300
|
||||
pkg syscall (openbsd-386-cgo), const SizeofIfData = 208
|
||||
pkg syscall (openbsd-386-cgo), const SizeofIfMsghdr = 232
|
||||
pkg syscall (openbsd-386-cgo), const SizeofRtMetrics = 48
|
||||
pkg syscall (openbsd-386-cgo), const SizeofRtMsghdr = 88
|
||||
pkg syscall (openbsd-386-cgo), const TIOCGTSTAMP = 1074295899
|
||||
pkg syscall (openbsd-386-cgo), type Dirent struct, Fileno uint32
|
||||
pkg syscall (openbsd-386-cgo), type FdSet struct, Bits [32]int32
|
||||
pkg syscall (openbsd-386-cgo), type Kevent_t struct, Data int32
|
||||
pkg syscall (openbsd-386-cgo), type Mclpool struct, Grown uint32
|
||||
pkg syscall (openbsd-386-cgo), type RtMetrics struct, Expire uint32
|
||||
pkg syscall (openbsd-386-cgo), type Stat_t struct, Ino uint32
|
||||
pkg syscall (openbsd-386-cgo), type Stat_t struct, Lspare0 int32
|
||||
pkg syscall (openbsd-386-cgo), type Stat_t struct, Lspare1 int32
|
||||
pkg syscall (openbsd-386-cgo), type Stat_t struct, Qspare [2]int64
|
||||
pkg syscall (openbsd-386-cgo), type Statfs_t struct, F_ctime uint32
|
||||
pkg syscall (openbsd-386-cgo), type Statfs_t struct, F_spare [3]uint32
|
||||
pkg syscall (openbsd-386-cgo), type Timespec struct, Sec int32
|
||||
pkg syscall (openbsd-386-cgo), type Timeval struct, Sec int32
|
||||
pkg syscall (openbsd-amd64), const CCR0_FLUSH = 16
|
||||
pkg syscall (openbsd-amd64), const CCR0_FLUSH ideal-int
|
||||
pkg syscall (openbsd-amd64), const CPUID_CFLUSH = 524288
|
||||
pkg syscall (openbsd-amd64), const CPUID_CFLUSH ideal-int
|
||||
pkg syscall (openbsd-amd64), const EFER_LMA = 1024
|
||||
pkg syscall (openbsd-amd64), const EFER_LMA ideal-int
|
||||
pkg syscall (openbsd-amd64), const EFER_LME = 256
|
||||
pkg syscall (openbsd-amd64), const EFER_LME ideal-int
|
||||
pkg syscall (openbsd-amd64), const EFER_NXE = 2048
|
||||
pkg syscall (openbsd-amd64), const EFER_NXE ideal-int
|
||||
pkg syscall (openbsd-amd64), const EFER_SCE = 1
|
||||
pkg syscall (openbsd-amd64), const EFER_SCE ideal-int
|
||||
pkg syscall (openbsd-amd64), const PMC5_PIPELINE_FLUSH = 21
|
||||
pkg syscall (openbsd-amd64), const PMC5_PIPELINE_FLUSH ideal-int
|
||||
pkg syscall (openbsd-amd64), const RTF_FMASK = 63496
|
||||
pkg syscall (openbsd-amd64), const RTM_VERSION = 4
|
||||
pkg syscall (openbsd-amd64), const SIOCBRDGDADDR = 2150132039
|
||||
pkg syscall (openbsd-amd64), const SIOCBRDGSADDR = 3223873860
|
||||
pkg syscall (openbsd-amd64), const SYS_CLOCK_GETRES = 234
|
||||
pkg syscall (openbsd-amd64), const SYS_CLOCK_GETTIME = 232
|
||||
pkg syscall (openbsd-amd64), const SYS_CLOCK_SETTIME = 233
|
||||
pkg syscall (openbsd-amd64), const SYS_FHSTATFS = 309
|
||||
pkg syscall (openbsd-amd64), const SYS_FSTAT = 292
|
||||
pkg syscall (openbsd-amd64), const SYS_FSTATAT = 316
|
||||
pkg syscall (openbsd-amd64), const SYS_FSTATFS = 308
|
||||
pkg syscall (openbsd-amd64), const SYS_FUTIMENS = 327
|
||||
pkg syscall (openbsd-amd64), const SYS_FUTIMES = 206
|
||||
pkg syscall (openbsd-amd64), const SYS_GETDIRENTRIES = 312
|
||||
pkg syscall (openbsd-amd64), const SYS_GETDIRENTRIES ideal-int
|
||||
pkg syscall (openbsd-amd64), const SYS_GETFSSTAT = 306
|
||||
pkg syscall (openbsd-amd64), const SYS_GETITIMER = 86
|
||||
pkg syscall (openbsd-amd64), const SYS_GETRUSAGE = 117
|
||||
pkg syscall (openbsd-amd64), const SYS_GETTIMEOFDAY = 116
|
||||
pkg syscall (openbsd-amd64), const SYS_KEVENT = 270
|
||||
pkg syscall (openbsd-amd64), const SYS_LSTAT = 293
|
||||
pkg syscall (openbsd-amd64), const SYS_NANOSLEEP = 240
|
||||
pkg syscall (openbsd-amd64), const SYS_SELECT = 93
|
||||
pkg syscall (openbsd-amd64), const SYS_SETITIMER = 83
|
||||
pkg syscall (openbsd-amd64), const SYS_SETTIMEOFDAY = 122
|
||||
pkg syscall (openbsd-amd64), const SYS_STAT = 291
|
||||
pkg syscall (openbsd-amd64), const SYS_STATFS = 307
|
||||
pkg syscall (openbsd-amd64), const SYS_UTIMENSAT = 326
|
||||
pkg syscall (openbsd-amd64), const SYS_UTIMES = 138
|
||||
pkg syscall (openbsd-amd64), const SYS_WAIT4 = 7
|
||||
pkg syscall (openbsd-amd64), const SYS___THRSLEEP = 300
|
||||
pkg syscall (openbsd-amd64), const SizeofRtMetrics = 48
|
||||
pkg syscall (openbsd-amd64), const SizeofRtMsghdr = 88
|
||||
pkg syscall (openbsd-amd64), type Dirent struct, Fileno uint32
|
||||
pkg syscall (openbsd-amd64), type FdSet struct, Bits [32]int32
|
||||
pkg syscall (openbsd-amd64), type Kevent_t struct, Data int32
|
||||
pkg syscall (openbsd-amd64), type Kevent_t struct, Ident uint32
|
||||
pkg syscall (openbsd-amd64), type Mclpool struct, Grown uint32
|
||||
pkg syscall (openbsd-amd64), type RtMetrics struct, Expire uint32
|
||||
pkg syscall (openbsd-amd64), type Stat_t struct, Ino uint32
|
||||
pkg syscall (openbsd-amd64), type Stat_t struct, Lspare0 int32
|
||||
pkg syscall (openbsd-amd64), type Stat_t struct, Lspare1 int32
|
||||
pkg syscall (openbsd-amd64), type Stat_t struct, Qspare [2]int64
|
||||
pkg syscall (openbsd-amd64), type Statfs_t struct, F_ctime uint32
|
||||
pkg syscall (openbsd-amd64), type Statfs_t struct, F_spare [3]uint32
|
||||
pkg syscall (openbsd-amd64), type Statfs_t struct, Pad_cgo_1 [4]uint8
|
||||
pkg syscall (openbsd-amd64), type Timespec struct, Pad_cgo_0 [4]uint8
|
||||
pkg syscall (openbsd-amd64), type Timespec struct, Sec int32
|
||||
pkg syscall (openbsd-amd64-cgo), const CCR0_FLUSH = 16
|
||||
pkg syscall (openbsd-amd64-cgo), const CCR0_FLUSH ideal-int
|
||||
pkg syscall (openbsd-amd64-cgo), const CPUID_CFLUSH = 524288
|
||||
pkg syscall (openbsd-amd64-cgo), const CPUID_CFLUSH ideal-int
|
||||
pkg syscall (openbsd-amd64-cgo), const EFER_LMA = 1024
|
||||
pkg syscall (openbsd-amd64-cgo), const EFER_LMA ideal-int
|
||||
pkg syscall (openbsd-amd64-cgo), const EFER_LME = 256
|
||||
pkg syscall (openbsd-amd64-cgo), const EFER_LME ideal-int
|
||||
pkg syscall (openbsd-amd64-cgo), const EFER_NXE = 2048
|
||||
pkg syscall (openbsd-amd64-cgo), const EFER_NXE ideal-int
|
||||
pkg syscall (openbsd-amd64-cgo), const EFER_SCE = 1
|
||||
pkg syscall (openbsd-amd64-cgo), const EFER_SCE ideal-int
|
||||
pkg syscall (openbsd-amd64-cgo), const PMC5_PIPELINE_FLUSH = 21
|
||||
pkg syscall (openbsd-amd64-cgo), const PMC5_PIPELINE_FLUSH ideal-int
|
||||
pkg syscall (openbsd-amd64-cgo), const RTF_FMASK = 63496
|
||||
pkg syscall (openbsd-amd64-cgo), const RTM_VERSION = 4
|
||||
pkg syscall (openbsd-amd64-cgo), const SIOCBRDGDADDR = 2150132039
|
||||
pkg syscall (openbsd-amd64-cgo), const SIOCBRDGSADDR = 3223873860
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_CLOCK_GETRES = 234
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_CLOCK_GETTIME = 232
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_CLOCK_SETTIME = 233
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_FHSTATFS = 309
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_FSTAT = 292
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_FSTATAT = 316
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_FSTATFS = 308
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_FUTIMENS = 327
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_FUTIMES = 206
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_GETDIRENTRIES = 312
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_GETDIRENTRIES ideal-int
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_GETFSSTAT = 306
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_GETITIMER = 86
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_GETRUSAGE = 117
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_GETTIMEOFDAY = 116
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_KEVENT = 270
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_LSTAT = 293
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_NANOSLEEP = 240
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_SELECT = 93
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_SETITIMER = 83
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_SETTIMEOFDAY = 122
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_STAT = 291
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_STATFS = 307
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_UTIMENSAT = 326
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_UTIMES = 138
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_WAIT4 = 7
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS___THRSLEEP = 300
|
||||
pkg syscall (openbsd-amd64-cgo), const SizeofRtMetrics = 48
|
||||
pkg syscall (openbsd-amd64-cgo), const SizeofRtMsghdr = 88
|
||||
pkg syscall (openbsd-amd64-cgo), type Dirent struct, Fileno uint32
|
||||
pkg syscall (openbsd-amd64-cgo), type FdSet struct, Bits [32]int32
|
||||
pkg syscall (openbsd-amd64-cgo), type Kevent_t struct, Data int32
|
||||
pkg syscall (openbsd-amd64-cgo), type Kevent_t struct, Ident uint32
|
||||
pkg syscall (openbsd-amd64-cgo), type Mclpool struct, Grown uint32
|
||||
pkg syscall (openbsd-amd64-cgo), type RtMetrics struct, Expire uint32
|
||||
pkg syscall (openbsd-amd64-cgo), type Stat_t struct, Ino uint32
|
||||
pkg syscall (openbsd-amd64-cgo), type Stat_t struct, Lspare0 int32
|
||||
pkg syscall (openbsd-amd64-cgo), type Stat_t struct, Lspare1 int32
|
||||
pkg syscall (openbsd-amd64-cgo), type Stat_t struct, Qspare [2]int64
|
||||
pkg syscall (openbsd-amd64-cgo), type Statfs_t struct, F_ctime uint32
|
||||
pkg syscall (openbsd-amd64-cgo), type Statfs_t struct, F_spare [3]uint32
|
||||
pkg syscall (openbsd-amd64-cgo), type Statfs_t struct, Pad_cgo_1 [4]uint8
|
||||
pkg syscall (openbsd-amd64-cgo), type Timespec struct, Pad_cgo_0 [4]uint8
|
||||
pkg syscall (openbsd-amd64-cgo), type Timespec struct, Sec int32
|
||||
pkg testing, func RegisterCover(Cover)
|
||||
pkg testing, func MainStart(func(string, string) (bool, error), []InternalTest, []InternalBenchmark, []InternalExample) *M
|
||||
pkg text/template/parse, type DotNode bool
|
||||
pkg text/template/parse, type Node interface { Copy, String, Type }
|
||||
pkg unicode, const Version = "6.2.0"
|
||||
pkg unicode, const Version = "6.3.0"
|
||||
pkg unicode, const Version = "7.0.0"
|
||||
pkg unicode, const Version = "8.0.0"
|
||||
pkg syscall (openbsd-386), const SYS_KILL = 37
|
||||
pkg syscall (openbsd-386-cgo), const SYS_KILL = 37
|
||||
pkg syscall (openbsd-amd64), const SYS_KILL = 37
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_KILL = 37
|
||||
50427
api/go1.1.txt
50427
api/go1.1.txt
File diff suppressed because it is too large
Load Diff
32484
api/go1.2.txt
32484
api/go1.2.txt
File diff suppressed because it is too large
Load Diff
2053
api/go1.3.txt
2053
api/go1.3.txt
File diff suppressed because it is too large
Load Diff
604
api/go1.4.txt
604
api/go1.4.txt
@@ -1,604 +0,0 @@
|
||||
# CL 134210043 archive/zip: add Writer.Flush, Brad Fitzpatrick <bradfitz@golang.org>
|
||||
pkg archive/zip, method (*Writer) Flush() error
|
||||
|
||||
# CL 97140043 compress/flate: add Reset() to allow reusing large buffers to compress multiple buffers, James Robinson <jamesr@google.com>
|
||||
pkg compress/flate, type Resetter interface { Reset }
|
||||
pkg compress/flate, type Resetter interface, Reset(io.Reader, []uint8) error
|
||||
pkg compress/zlib, type Resetter interface { Reset }
|
||||
pkg compress/zlib, type Resetter interface, Reset(io.Reader, []uint8) error
|
||||
|
||||
# CL 159120044 compress/gzip: allow stopping at end of first stream, Russ Cox <rsc@golang.org>
|
||||
pkg compress/gzip, method (*Reader) Multistream(bool)
|
||||
|
||||
# CL 138800043 crypto: Add SHA3 functions in go.crypto/sha3 to the Hash enum., David Leon Gil <coruus@gmail.com>
|
||||
pkg crypto, const SHA3_224 = 10
|
||||
pkg crypto, const SHA3_224 Hash
|
||||
pkg crypto, const SHA3_256 = 11
|
||||
pkg crypto, const SHA3_256 Hash
|
||||
pkg crypto, const SHA3_384 = 12
|
||||
pkg crypto, const SHA3_384 Hash
|
||||
pkg crypto, const SHA3_512 = 13
|
||||
pkg crypto, const SHA3_512 Hash
|
||||
|
||||
# CL 114680043 crypto: add Signer, Adam Langley <agl@golang.org>
|
||||
pkg crypto, method (Hash) HashFunc() Hash
|
||||
pkg crypto, type Signer interface { Public, Sign }
|
||||
pkg crypto, type Signer interface, Public() PublicKey
|
||||
pkg crypto, type Signer interface, Sign(io.Reader, []uint8, SignerOpts) ([]uint8, error)
|
||||
pkg crypto, type SignerOpts interface { HashFunc }
|
||||
pkg crypto, type SignerOpts interface, HashFunc() Hash
|
||||
pkg crypto/ecdsa, method (*PrivateKey) Public() crypto.PublicKey
|
||||
pkg crypto/ecdsa, method (*PrivateKey) Sign(io.Reader, []uint8, crypto.SignerOpts) ([]uint8, error)
|
||||
pkg crypto/rsa, method (*PSSOptions) HashFunc() crypto.Hash
|
||||
pkg crypto/rsa, method (*PrivateKey) Public() crypto.PublicKey
|
||||
pkg crypto/rsa, method (*PrivateKey) Sign(io.Reader, []uint8, crypto.SignerOpts) ([]uint8, error)
|
||||
pkg crypto/rsa, type PSSOptions struct, Hash crypto.Hash
|
||||
|
||||
# CL 157090043 crypto/tls: support TLS_FALLBACK_SCSV as a server., Adam Langley <agl@golang.org>
|
||||
pkg crypto/tls, const TLS_FALLBACK_SCSV = 22016
|
||||
pkg crypto/tls, const TLS_FALLBACK_SCSV uint16
|
||||
|
||||
# CL 107400043 crypto/tls: Added dynamic alternative to NameToCertificate map for SNI, Percy Wegmann <ox.to.a.cart@gmail.com>
|
||||
pkg crypto/tls, type ClientHelloInfo struct
|
||||
pkg crypto/tls, type ClientHelloInfo struct, CipherSuites []uint16
|
||||
pkg crypto/tls, type ClientHelloInfo struct, ServerName string
|
||||
pkg crypto/tls, type ClientHelloInfo struct, SupportedCurves []CurveID
|
||||
pkg crypto/tls, type ClientHelloInfo struct, SupportedPoints []uint8
|
||||
pkg crypto/tls, type Config struct, GetCertificate func(*ClientHelloInfo) (*Certificate, error)
|
||||
pkg crypto/tls, type ConnectionState struct, TLSUnique []uint8
|
||||
|
||||
# CL 153420045 crypto/x509: continue to recognise MaxPathLen of zero as "no value"., Adam Langley <agl@golang.org>
|
||||
pkg crypto/x509, type Certificate struct, MaxPathLenZero bool
|
||||
|
||||
# CL 158950043 database/sql: add Drivers, returning list of registered drivers, Russ Cox <rsc@golang.org>
|
||||
pkg database/sql, func Drivers() []string
|
||||
|
||||
# CL 117280043 debug/dwarf: fix Reader panic on DW_TAG_unspecified_type, Derek Parker <parkerderek86@gmail.com>
|
||||
pkg debug/dwarf, method (*UnspecifiedType) Basic() *BasicType
|
||||
pkg debug/dwarf, method (*UnspecifiedType) Common() *CommonType
|
||||
pkg debug/dwarf, method (*UnspecifiedType) Size() int64
|
||||
pkg debug/dwarf, method (*UnspecifiedType) String() string
|
||||
pkg debug/dwarf, type UnspecifiedType struct
|
||||
pkg debug/dwarf, type UnspecifiedType struct, embedded BasicType
|
||||
|
||||
# CL 132000043 debug/elf: support arm64 relocations, Michael Hudson-Doyle <michael.hudson@linaro.org>
|
||||
pkg debug/elf, const EM_AARCH64 = 183
|
||||
pkg debug/elf, const EM_AARCH64 Machine
|
||||
pkg debug/elf, const R_AARCH64_ABS16 = 259
|
||||
pkg debug/elf, const R_AARCH64_ABS16 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_ABS32 = 258
|
||||
pkg debug/elf, const R_AARCH64_ABS32 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_ABS64 = 257
|
||||
pkg debug/elf, const R_AARCH64_ABS64 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_ADD_ABS_LO12_NC = 277
|
||||
pkg debug/elf, const R_AARCH64_ADD_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_ADR_GOT_PAGE = 311
|
||||
pkg debug/elf, const R_AARCH64_ADR_GOT_PAGE R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_ADR_PREL_LO21 = 274
|
||||
pkg debug/elf, const R_AARCH64_ADR_PREL_LO21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_ADR_PREL_PG_HI21 = 275
|
||||
pkg debug/elf, const R_AARCH64_ADR_PREL_PG_HI21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_ADR_PREL_PG_HI21_NC = 276
|
||||
pkg debug/elf, const R_AARCH64_ADR_PREL_PG_HI21_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_CALL26 = 283
|
||||
pkg debug/elf, const R_AARCH64_CALL26 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_CONDBR19 = 280
|
||||
pkg debug/elf, const R_AARCH64_CONDBR19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_COPY = 1024
|
||||
pkg debug/elf, const R_AARCH64_COPY R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_GLOB_DAT = 1025
|
||||
pkg debug/elf, const R_AARCH64_GLOB_DAT R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_GOT_LD_PREL19 = 309
|
||||
pkg debug/elf, const R_AARCH64_GOT_LD_PREL19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_IRELATIVE = 1032
|
||||
pkg debug/elf, const R_AARCH64_IRELATIVE R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_JUMP26 = 282
|
||||
pkg debug/elf, const R_AARCH64_JUMP26 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_JUMP_SLOT = 1026
|
||||
pkg debug/elf, const R_AARCH64_JUMP_SLOT R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_LD64_GOT_LO12_NC = 312
|
||||
pkg debug/elf, const R_AARCH64_LD64_GOT_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_LDST128_ABS_LO12_NC = 299
|
||||
pkg debug/elf, const R_AARCH64_LDST128_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_LDST16_ABS_LO12_NC = 284
|
||||
pkg debug/elf, const R_AARCH64_LDST16_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_LDST32_ABS_LO12_NC = 285
|
||||
pkg debug/elf, const R_AARCH64_LDST32_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_LDST64_ABS_LO12_NC = 286
|
||||
pkg debug/elf, const R_AARCH64_LDST64_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_LDST8_ABS_LO12_NC = 278
|
||||
pkg debug/elf, const R_AARCH64_LDST8_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_LD_PREL_LO19 = 273
|
||||
pkg debug/elf, const R_AARCH64_LD_PREL_LO19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_SABS_G0 = 270
|
||||
pkg debug/elf, const R_AARCH64_MOVW_SABS_G0 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_SABS_G1 = 271
|
||||
pkg debug/elf, const R_AARCH64_MOVW_SABS_G1 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_SABS_G2 = 272
|
||||
pkg debug/elf, const R_AARCH64_MOVW_SABS_G2 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G0 = 263
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G0 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G0_NC = 264
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G0_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G1 = 265
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G1 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G1_NC = 266
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G1_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G2 = 267
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G2 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G2_NC = 268
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G2_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G3 = 269
|
||||
pkg debug/elf, const R_AARCH64_MOVW_UABS_G3 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_NONE = 0
|
||||
pkg debug/elf, const R_AARCH64_NONE R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_NULL = 256
|
||||
pkg debug/elf, const R_AARCH64_NULL R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_ABS16 = 2
|
||||
pkg debug/elf, const R_AARCH64_P32_ABS16 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_ABS32 = 1
|
||||
pkg debug/elf, const R_AARCH64_P32_ABS32 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_ADD_ABS_LO12_NC = 12
|
||||
pkg debug/elf, const R_AARCH64_P32_ADD_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_ADR_GOT_PAGE = 26
|
||||
pkg debug/elf, const R_AARCH64_P32_ADR_GOT_PAGE R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_ADR_PREL_LO21 = 10
|
||||
pkg debug/elf, const R_AARCH64_P32_ADR_PREL_LO21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_ADR_PREL_PG_HI21 = 11
|
||||
pkg debug/elf, const R_AARCH64_P32_ADR_PREL_PG_HI21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_CALL26 = 21
|
||||
pkg debug/elf, const R_AARCH64_P32_CALL26 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_CONDBR19 = 19
|
||||
pkg debug/elf, const R_AARCH64_P32_CONDBR19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_COPY = 180
|
||||
pkg debug/elf, const R_AARCH64_P32_COPY R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_GLOB_DAT = 181
|
||||
pkg debug/elf, const R_AARCH64_P32_GLOB_DAT R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_GOT_LD_PREL19 = 25
|
||||
pkg debug/elf, const R_AARCH64_P32_GOT_LD_PREL19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_IRELATIVE = 188
|
||||
pkg debug/elf, const R_AARCH64_P32_IRELATIVE R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_JUMP26 = 20
|
||||
pkg debug/elf, const R_AARCH64_P32_JUMP26 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_JUMP_SLOT = 182
|
||||
pkg debug/elf, const R_AARCH64_P32_JUMP_SLOT R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_LD32_GOT_LO12_NC = 27
|
||||
pkg debug/elf, const R_AARCH64_P32_LD32_GOT_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST128_ABS_LO12_NC = 17
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST128_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST16_ABS_LO12_NC = 14
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST16_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST32_ABS_LO12_NC = 15
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST32_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST64_ABS_LO12_NC = 16
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST64_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST8_ABS_LO12_NC = 13
|
||||
pkg debug/elf, const R_AARCH64_P32_LDST8_ABS_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_LD_PREL_LO19 = 9
|
||||
pkg debug/elf, const R_AARCH64_P32_LD_PREL_LO19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_MOVW_SABS_G0 = 8
|
||||
pkg debug/elf, const R_AARCH64_P32_MOVW_SABS_G0 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_MOVW_UABS_G0 = 5
|
||||
pkg debug/elf, const R_AARCH64_P32_MOVW_UABS_G0 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_MOVW_UABS_G0_NC = 6
|
||||
pkg debug/elf, const R_AARCH64_P32_MOVW_UABS_G0_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_MOVW_UABS_G1 = 7
|
||||
pkg debug/elf, const R_AARCH64_P32_MOVW_UABS_G1 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_PREL16 = 4
|
||||
pkg debug/elf, const R_AARCH64_P32_PREL16 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_PREL32 = 3
|
||||
pkg debug/elf, const R_AARCH64_P32_PREL32 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_RELATIVE = 183
|
||||
pkg debug/elf, const R_AARCH64_P32_RELATIVE R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC = 187
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_ADD_LO12_NC = 126
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_ADD_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_ADR_PAGE21 = 124
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_ADR_PAGE21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_ADR_PREL21 = 123
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_ADR_PREL21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_CALL = 127
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_CALL R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_LD32_LO12_NC = 125
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_LD32_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_LD_PREL19 = 122
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSDESC_LD_PREL19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSGD_ADD_LO12_NC = 82
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSGD_ADD_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSGD_ADR_PAGE21 = 81
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSGD_ADR_PAGE21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21 = 103
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC = 104
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19 = 105
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_ADD_TPREL_HI12 = 109
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_ADD_TPREL_HI12 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_ADD_TPREL_LO12 = 110
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_ADD_TPREL_LO12 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC = 111
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_MOVW_TPREL_G0 = 107
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_MOVW_TPREL_G0 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC = 108
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_MOVW_TPREL_G1 = 106
|
||||
pkg debug/elf, const R_AARCH64_P32_TLSLE_MOVW_TPREL_G1 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLS_DTPMOD = 184
|
||||
pkg debug/elf, const R_AARCH64_P32_TLS_DTPMOD R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLS_DTPREL = 185
|
||||
pkg debug/elf, const R_AARCH64_P32_TLS_DTPREL R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TLS_TPREL = 186
|
||||
pkg debug/elf, const R_AARCH64_P32_TLS_TPREL R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_P32_TSTBR14 = 18
|
||||
pkg debug/elf, const R_AARCH64_P32_TSTBR14 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_PREL16 = 262
|
||||
pkg debug/elf, const R_AARCH64_PREL16 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_PREL32 = 261
|
||||
pkg debug/elf, const R_AARCH64_PREL32 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_PREL64 = 260
|
||||
pkg debug/elf, const R_AARCH64_PREL64 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_RELATIVE = 1027
|
||||
pkg debug/elf, const R_AARCH64_RELATIVE R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC = 1031
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_ADD = 568
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_ADD R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_ADD_LO12_NC = 564
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_ADD_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_ADR_PAGE21 = 562
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_ADR_PAGE21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_ADR_PREL21 = 561
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_ADR_PREL21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_CALL = 569
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_CALL R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_LD64_LO12_NC = 563
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_LD64_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_LDR = 567
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_LDR R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_LD_PREL19 = 560
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_LD_PREL19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_OFF_G0_NC = 566
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_OFF_G0_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_OFF_G1 = 565
|
||||
pkg debug/elf, const R_AARCH64_TLSDESC_OFF_G1 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSGD_ADD_LO12_NC = 514
|
||||
pkg debug/elf, const R_AARCH64_TLSGD_ADD_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSGD_ADR_PAGE21 = 513
|
||||
pkg debug/elf, const R_AARCH64_TLSGD_ADR_PAGE21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 541
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 542
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 543
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 540
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 539
|
||||
pkg debug/elf, const R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_ADD_TPREL_HI12 = 549
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_ADD_TPREL_HI12 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_ADD_TPREL_LO12 = 550
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_ADD_TPREL_LO12 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 551
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_ADD_TPREL_LO12_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G0 = 547
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G0 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 548
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G0_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G1 = 545
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G1 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 546
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G1_NC R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G2 = 544
|
||||
pkg debug/elf, const R_AARCH64_TLSLE_MOVW_TPREL_G2 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLS_DTPMOD64 = 1028
|
||||
pkg debug/elf, const R_AARCH64_TLS_DTPMOD64 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLS_DTPREL64 = 1029
|
||||
pkg debug/elf, const R_AARCH64_TLS_DTPREL64 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TLS_TPREL64 = 1030
|
||||
pkg debug/elf, const R_AARCH64_TLS_TPREL64 R_AARCH64
|
||||
pkg debug/elf, const R_AARCH64_TSTBR14 = 279
|
||||
pkg debug/elf, const R_AARCH64_TSTBR14 R_AARCH64
|
||||
pkg debug/elf, method (R_AARCH64) GoString() string
|
||||
pkg debug/elf, method (R_AARCH64) String() string
|
||||
pkg debug/elf, type R_AARCH64 int
|
||||
|
||||
# CL 107530043 debug/elf: add (*File).DynamicSymbols, ErrNoSymbols, and tests for (*File).Symbols and (*File).DynamicSymbols, and formalize symbol order., Pietro Gagliardi <pietro10@mac.com>
|
||||
pkg debug/elf, method (*File) DynamicSymbols() ([]Symbol, error)
|
||||
pkg debug/elf, var ErrNoSymbols error
|
||||
|
||||
# CL 106460044 debug/plan9obj, cmd/addr2line: on Plan 9 use a.out header, Aram Hăvărneanu <aram@mgk.ro>
|
||||
pkg debug/plan9obj, type FileHeader struct, HdrSize uint64
|
||||
pkg debug/plan9obj, type FileHeader struct, LoadAddress uint64
|
||||
|
||||
# CL 122960043 encoding/xml: add InputOffset method to Decoder, Russ Cox <rsc@golang.org>
|
||||
pkg encoding/xml, method (*Decoder) InputOffset() int64
|
||||
|
||||
# CL 124940043 cmd/go, go/build: implement import comment checking, Russ Cox <rsc@golang.org>
|
||||
pkg go/build, const ImportComment = 4
|
||||
pkg go/build, const ImportComment ImportMode
|
||||
pkg go/build, type Package struct, ImportComment string
|
||||
|
||||
# CL 155050043 go/build: Return MultiplePackageError on importing a dir containing multiple packages, Jens Frederich <jfrederich@gmail.com>
|
||||
pkg go/build, method (*MultiplePackageError) Error() string
|
||||
pkg go/build, type MultiplePackageError struct
|
||||
pkg go/build, type MultiplePackageError struct, Dir string
|
||||
pkg go/build, type MultiplePackageError struct, Files []string
|
||||
pkg go/build, type MultiplePackageError struct, Packages []string
|
||||
|
||||
# CL 135110044 go/token: implement PositionFor accessors, Robert Griesemer <gri@golang.org>
|
||||
pkg go/token, method (*File) PositionFor(Pos, bool) Position
|
||||
pkg go/token, method (*FileSet) PositionFor(Pos, bool) Position
|
||||
|
||||
# CL 109000049 image: add RGBAAt, Gray16At, etc., ChaiShushan <chaishushan@gmail.com>
|
||||
pkg image, method (*Alpha) AlphaAt(int, int) color.Alpha
|
||||
pkg image, method (*Alpha16) Alpha16At(int, int) color.Alpha16
|
||||
pkg image, method (*Gray) GrayAt(int, int) color.Gray
|
||||
pkg image, method (*Gray16) Gray16At(int, int) color.Gray16
|
||||
pkg image, method (*NRGBA) NRGBAAt(int, int) color.NRGBA
|
||||
pkg image, method (*NRGBA64) NRGBA64At(int, int) color.NRGBA64
|
||||
pkg image, method (*RGBA) RGBAAt(int, int) color.RGBA
|
||||
pkg image, method (*RGBA64) RGBA64At(int, int) color.RGBA64
|
||||
pkg image, method (*YCbCr) YCbCrAt(int, int) color.YCbCr
|
||||
|
||||
# CL 129190043 png: make the encoder configurable, Jeff R. Allen <jra@nella.org>
|
||||
pkg image/png, const BestCompression = -3
|
||||
pkg image/png, const BestCompression CompressionLevel
|
||||
pkg image/png, const BestSpeed = -2
|
||||
pkg image/png, const BestSpeed CompressionLevel
|
||||
pkg image/png, const DefaultCompression = 0
|
||||
pkg image/png, const DefaultCompression CompressionLevel
|
||||
pkg image/png, const NoCompression = -1
|
||||
pkg image/png, const NoCompression CompressionLevel
|
||||
pkg image/png, method (*Encoder) Encode(io.Writer, image.Image) error
|
||||
pkg image/png, type CompressionLevel int
|
||||
pkg image/png, type Encoder struct
|
||||
pkg image/png, type Encoder struct, CompressionLevel CompressionLevel
|
||||
|
||||
# CL 101750048 math: implement Nextafter32, Robert Griesemer <gri@golang.org>
|
||||
pkg math, func Nextafter32(float32, float32) float32
|
||||
|
||||
# CL 93550043 math/big: implement Rat.Float32, Robert Griesemer <gri@golang.org>
|
||||
pkg math/big, method (*Rat) Float32() (float32, bool)
|
||||
|
||||
# CL 76540043 net/http: add BasicAuth method to *http.Request, Kelsey Hightower <kelsey.hightower@gmail.com>
|
||||
pkg net/http, method (*Request) BasicAuth() (string, string, bool)
|
||||
|
||||
# CL 137940043 net/http: add Transport.DialTLS hook, Brad Fitzpatrick <bradfitz@golang.org>
|
||||
pkg net/http, type Transport struct, DialTLS func(string, string) (net.Conn, error)
|
||||
|
||||
# CL 132750043 net/http/httputil: Pass a Logger to ReverseProxy, allowing the user to control logging., Mark Theunissen <mark.theunissen@gmail.com>
|
||||
pkg net/http/httputil, type ReverseProxy struct, ErrorLog *log.Logger
|
||||
|
||||
# CL 148370043 os, syscall: add Unsetenv, Brad Fitzpatrick <bradfitz@golang.org>
|
||||
pkg os, func Unsetenv(string) error
|
||||
pkg syscall, func Unsetenv(string) error
|
||||
|
||||
# CL 144020043 reflect: add Type.Comparable, Russ Cox <rsc@golang.org>
|
||||
pkg reflect, type Type interface, Comparable() bool
|
||||
|
||||
# CL 153670043 runtime: add PauseEnd array to MemStats and GCStats, Jens Frederich <jfrederich@gmail.com>
|
||||
pkg runtime, type MemStats struct, PauseEnd [256]uint64
|
||||
pkg runtime/debug, type GCStats struct, PauseEnd []time.Time
|
||||
|
||||
# CL 136710045 sync/atomic: add Value, Dmitriy Vyukov <dvyukov@google.com>
|
||||
pkg sync/atomic, method (*Value) Load() interface{}
|
||||
pkg sync/atomic, method (*Value) Store(interface{})
|
||||
pkg sync/atomic, type Value struct
|
||||
|
||||
# CL 126190043 syscall: support UID/GID map files for Linux user namespaces, Mrunal Patel <mrunalp@gmail.com>
|
||||
pkg syscall (linux-386), type SysProcAttr struct, GidMappings []SysProcIDMap
|
||||
pkg syscall (linux-386), type SysProcAttr struct, UidMappings []SysProcIDMap
|
||||
pkg syscall (linux-386), type SysProcIDMap struct
|
||||
pkg syscall (linux-386), type SysProcIDMap struct, ContainerID int
|
||||
pkg syscall (linux-386), type SysProcIDMap struct, HostID int
|
||||
pkg syscall (linux-386), type SysProcIDMap struct, Size int
|
||||
pkg syscall (linux-386-cgo), type SysProcAttr struct, GidMappings []SysProcIDMap
|
||||
pkg syscall (linux-386-cgo), type SysProcAttr struct, UidMappings []SysProcIDMap
|
||||
pkg syscall (linux-386-cgo), type SysProcIDMap struct
|
||||
pkg syscall (linux-386-cgo), type SysProcIDMap struct, ContainerID int
|
||||
pkg syscall (linux-386-cgo), type SysProcIDMap struct, HostID int
|
||||
pkg syscall (linux-386-cgo), type SysProcIDMap struct, Size int
|
||||
pkg syscall (linux-amd64), type SysProcAttr struct, GidMappings []SysProcIDMap
|
||||
pkg syscall (linux-amd64), type SysProcAttr struct, UidMappings []SysProcIDMap
|
||||
pkg syscall (linux-amd64), type SysProcIDMap struct
|
||||
pkg syscall (linux-amd64), type SysProcIDMap struct, ContainerID int
|
||||
pkg syscall (linux-amd64), type SysProcIDMap struct, HostID int
|
||||
pkg syscall (linux-amd64), type SysProcIDMap struct, Size int
|
||||
pkg syscall (linux-amd64-cgo), type SysProcAttr struct, GidMappings []SysProcIDMap
|
||||
pkg syscall (linux-amd64-cgo), type SysProcAttr struct, UidMappings []SysProcIDMap
|
||||
pkg syscall (linux-amd64-cgo), type SysProcIDMap struct
|
||||
pkg syscall (linux-amd64-cgo), type SysProcIDMap struct, ContainerID int
|
||||
pkg syscall (linux-amd64-cgo), type SysProcIDMap struct, HostID int
|
||||
pkg syscall (linux-amd64-cgo), type SysProcIDMap struct, Size int
|
||||
pkg syscall (linux-arm), type SysProcAttr struct, GidMappings []SysProcIDMap
|
||||
pkg syscall (linux-arm), type SysProcAttr struct, UidMappings []SysProcIDMap
|
||||
pkg syscall (linux-arm), type SysProcIDMap struct
|
||||
pkg syscall (linux-arm), type SysProcIDMap struct, ContainerID int
|
||||
pkg syscall (linux-arm), type SysProcIDMap struct, HostID int
|
||||
pkg syscall (linux-arm), type SysProcIDMap struct, Size int
|
||||
pkg syscall (linux-arm-cgo), type SysProcAttr struct, GidMappings []SysProcIDMap
|
||||
pkg syscall (linux-arm-cgo), type SysProcAttr struct, UidMappings []SysProcIDMap
|
||||
pkg syscall (linux-arm-cgo), type SysProcIDMap struct
|
||||
pkg syscall (linux-arm-cgo), type SysProcIDMap struct, ContainerID int
|
||||
pkg syscall (linux-arm-cgo), type SysProcIDMap struct, HostID int
|
||||
pkg syscall (linux-arm-cgo), type SysProcIDMap struct, Size int
|
||||
|
||||
# CL 122200043 net: fix CNAME resolving on Windows, Egon Elbre <egonelbre@gmail.com>
|
||||
pkg syscall (windows-386), const DNS_INFO_NO_RECORDS = 9501
|
||||
pkg syscall (windows-386), const DNS_INFO_NO_RECORDS ideal-int
|
||||
pkg syscall (windows-386), const DnsSectionAdditional = 3
|
||||
pkg syscall (windows-386), const DnsSectionAdditional ideal-int
|
||||
pkg syscall (windows-386), const DnsSectionAnswer = 1
|
||||
pkg syscall (windows-386), const DnsSectionAnswer ideal-int
|
||||
pkg syscall (windows-386), const DnsSectionAuthority = 2
|
||||
pkg syscall (windows-386), const DnsSectionAuthority ideal-int
|
||||
pkg syscall (windows-386), const DnsSectionQuestion = 0
|
||||
pkg syscall (windows-386), const DnsSectionQuestion ideal-int
|
||||
pkg syscall (windows-386), func DnsNameCompare(*uint16, *uint16) bool
|
||||
pkg syscall (windows-amd64), const DNS_INFO_NO_RECORDS = 9501
|
||||
pkg syscall (windows-amd64), const DNS_INFO_NO_RECORDS ideal-int
|
||||
pkg syscall (windows-amd64), const DnsSectionAdditional = 3
|
||||
pkg syscall (windows-amd64), const DnsSectionAdditional ideal-int
|
||||
pkg syscall (windows-amd64), const DnsSectionAnswer = 1
|
||||
pkg syscall (windows-amd64), const DnsSectionAnswer ideal-int
|
||||
pkg syscall (windows-amd64), const DnsSectionAuthority = 2
|
||||
pkg syscall (windows-amd64), const DnsSectionAuthority ideal-int
|
||||
pkg syscall (windows-amd64), const DnsSectionQuestion = 0
|
||||
pkg syscall (windows-amd64), const DnsSectionQuestion ideal-int
|
||||
pkg syscall (windows-amd64), func DnsNameCompare(*uint16, *uint16) bool
|
||||
|
||||
# CL 86160044 os: Implement symlink support for Windows, Michael Fraenkel <michael.fraenkel@gmail.com>
|
||||
pkg syscall (windows-386), const ERROR_PRIVILEGE_NOT_HELD = 1314
|
||||
pkg syscall (windows-386), const ERROR_PRIVILEGE_NOT_HELD Errno
|
||||
pkg syscall (windows-amd64), const ERROR_PRIVILEGE_NOT_HELD = 1314
|
||||
pkg syscall (windows-amd64), const ERROR_PRIVILEGE_NOT_HELD Errno
|
||||
|
||||
# CL 86160044 os: Implement symlink support for Windows, Michael Fraenkel <michael.fraenkel@gmail.com>
|
||||
pkg syscall (windows-386), const FILE_ATTRIBUTE_REPARSE_POINT = 1024
|
||||
pkg syscall (windows-386), const FILE_ATTRIBUTE_REPARSE_POINT ideal-int
|
||||
pkg syscall (windows-386), const FILE_FLAG_OPEN_REPARSE_POINT = 2097152
|
||||
pkg syscall (windows-386), const FILE_FLAG_OPEN_REPARSE_POINT ideal-int
|
||||
pkg syscall (windows-386), const FSCTL_GET_REPARSE_POINT = 589992
|
||||
pkg syscall (windows-386), const FSCTL_GET_REPARSE_POINT ideal-int
|
||||
pkg syscall (windows-386), const IO_REPARSE_TAG_SYMLINK = 2684354572
|
||||
pkg syscall (windows-386), const IO_REPARSE_TAG_SYMLINK ideal-int
|
||||
pkg syscall (windows-386), const MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384
|
||||
pkg syscall (windows-386), const MAXIMUM_REPARSE_DATA_BUFFER_SIZE ideal-int
|
||||
pkg syscall (windows-386), const SYMBOLIC_LINK_FLAG_DIRECTORY = 1
|
||||
pkg syscall (windows-386), const SYMBOLIC_LINK_FLAG_DIRECTORY ideal-int
|
||||
pkg syscall (windows-386), func CreateHardLink(*uint16, *uint16, uintptr) error
|
||||
pkg syscall (windows-386), func CreateSymbolicLink(*uint16, *uint16, uint32) error
|
||||
pkg syscall (windows-386), func DeviceIoControl(Handle, uint32, *uint8, uint32, *uint8, uint32, *uint32, *Overlapped) error
|
||||
pkg syscall (windows-386), func LoadCreateSymbolicLink() error
|
||||
pkg syscall (windows-amd64), const FILE_ATTRIBUTE_REPARSE_POINT = 1024
|
||||
pkg syscall (windows-amd64), const FILE_ATTRIBUTE_REPARSE_POINT ideal-int
|
||||
pkg syscall (windows-amd64), const FILE_FLAG_OPEN_REPARSE_POINT = 2097152
|
||||
pkg syscall (windows-amd64), const FILE_FLAG_OPEN_REPARSE_POINT ideal-int
|
||||
pkg syscall (windows-amd64), const FSCTL_GET_REPARSE_POINT = 589992
|
||||
pkg syscall (windows-amd64), const FSCTL_GET_REPARSE_POINT ideal-int
|
||||
pkg syscall (windows-amd64), const IO_REPARSE_TAG_SYMLINK = 2684354572
|
||||
pkg syscall (windows-amd64), const IO_REPARSE_TAG_SYMLINK ideal-int
|
||||
pkg syscall (windows-amd64), const MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384
|
||||
pkg syscall (windows-amd64), const MAXIMUM_REPARSE_DATA_BUFFER_SIZE ideal-int
|
||||
pkg syscall (windows-amd64), const SYMBOLIC_LINK_FLAG_DIRECTORY = 1
|
||||
pkg syscall (windows-amd64), const SYMBOLIC_LINK_FLAG_DIRECTORY ideal-int
|
||||
pkg syscall (windows-amd64), func CreateHardLink(*uint16, *uint16, uintptr) error
|
||||
pkg syscall (windows-amd64), func CreateSymbolicLink(*uint16, *uint16, uint32) error
|
||||
pkg syscall (windows-amd64), func DeviceIoControl(Handle, uint32, *uint8, uint32, *uint8, uint32, *uint32, *Overlapped) error
|
||||
pkg syscall (windows-amd64), func LoadCreateSymbolicLink() error
|
||||
|
||||
# CL 149510043 net: disable SIO_UDP_CONNRESET behavior on windows., Ron Hashimoto <mail@h2so5.net>
|
||||
pkg syscall (windows-386), const SIO_UDP_CONNRESET = 2550136844
|
||||
pkg syscall (windows-386), const SIO_UDP_CONNRESET ideal-int
|
||||
pkg syscall (windows-amd64), const SIO_UDP_CONNRESET = 2550136844
|
||||
pkg syscall (windows-amd64), const SIO_UDP_CONNRESET ideal-int
|
||||
|
||||
# CL 102320044 syscall: implement syscall.Getppid() on Windows, Alan Shreve <alan@inconshreveable.com>
|
||||
pkg syscall (windows-386), const TH32CS_INHERIT = 2147483648
|
||||
pkg syscall (windows-386), const TH32CS_INHERIT ideal-int
|
||||
pkg syscall (windows-386), const TH32CS_SNAPALL = 15
|
||||
pkg syscall (windows-386), const TH32CS_SNAPALL ideal-int
|
||||
pkg syscall (windows-386), const TH32CS_SNAPHEAPLIST = 1
|
||||
pkg syscall (windows-386), const TH32CS_SNAPHEAPLIST ideal-int
|
||||
pkg syscall (windows-386), const TH32CS_SNAPMODULE = 8
|
||||
pkg syscall (windows-386), const TH32CS_SNAPMODULE ideal-int
|
||||
pkg syscall (windows-386), const TH32CS_SNAPMODULE32 = 16
|
||||
pkg syscall (windows-386), const TH32CS_SNAPMODULE32 ideal-int
|
||||
pkg syscall (windows-386), const TH32CS_SNAPPROCESS = 2
|
||||
pkg syscall (windows-386), const TH32CS_SNAPPROCESS ideal-int
|
||||
pkg syscall (windows-386), const TH32CS_SNAPTHREAD = 4
|
||||
pkg syscall (windows-386), const TH32CS_SNAPTHREAD ideal-int
|
||||
pkg syscall (windows-386), func CreateToolhelp32Snapshot(uint32, uint32) (Handle, error)
|
||||
pkg syscall (windows-386), func Process32First(Handle, *ProcessEntry32) error
|
||||
pkg syscall (windows-386), func Process32Next(Handle, *ProcessEntry32) error
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, DefaultHeapID uintptr
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, ExeFile [260]uint16
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, Flags uint32
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, ModuleID uint32
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, ParentProcessID uint32
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, PriClassBase int32
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, ProcessID uint32
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, Size uint32
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, Threads uint32
|
||||
pkg syscall (windows-386), type ProcessEntry32 struct, Usage uint32
|
||||
pkg syscall (windows-amd64), const TH32CS_INHERIT = 2147483648
|
||||
pkg syscall (windows-amd64), const TH32CS_INHERIT ideal-int
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPALL = 15
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPALL ideal-int
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPHEAPLIST = 1
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPHEAPLIST ideal-int
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPMODULE = 8
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPMODULE ideal-int
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPMODULE32 = 16
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPMODULE32 ideal-int
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPPROCESS = 2
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPPROCESS ideal-int
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPTHREAD = 4
|
||||
pkg syscall (windows-amd64), const TH32CS_SNAPTHREAD ideal-int
|
||||
pkg syscall (windows-amd64), func CreateToolhelp32Snapshot(uint32, uint32) (Handle, error)
|
||||
pkg syscall (windows-amd64), func Process32First(Handle, *ProcessEntry32) error
|
||||
pkg syscall (windows-amd64), func Process32Next(Handle, *ProcessEntry32) error
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, DefaultHeapID uintptr
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, ExeFile [260]uint16
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, Flags uint32
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, ModuleID uint32
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, ParentProcessID uint32
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, PriClassBase int32
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, ProcessID uint32
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, Size uint32
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, Threads uint32
|
||||
pkg syscall (windows-amd64), type ProcessEntry32 struct, Usage uint32
|
||||
|
||||
# CL 127740043 os: make SameFile handle paths like c:a.txt properly, Alex Brainman <alex.brainman@gmail.com>
|
||||
pkg syscall (windows-386), func FullPath(string) (string, error)
|
||||
pkg syscall (windows-amd64), func FullPath(string) (string, error)
|
||||
|
||||
# CL 98150043 testing: add Coverage function, Russ Cox <rsc@golang.org>
|
||||
pkg testing, func Coverage() float64
|
||||
|
||||
# CL 148770043 cmd/go, testing: add TestMain support, Russ Cox <rsc@golang.org>
|
||||
pkg testing, func MainStart(func(string, string) (bool, error), []InternalTest, []InternalBenchmark, []InternalExample) *M
|
||||
pkg testing, method (*M) Run() int
|
||||
pkg testing, type M struct
|
||||
|
||||
# CL 108030044 text/scanner: provide facility for custom identifiers, Robert Griesemer <gri@golang.org>
|
||||
pkg text/scanner, type Scanner struct, IsIdentRune func(int32, int) bool
|
||||
|
||||
# CL 130620043 text/template: add back pointer to Nodes for better error generation, Rob Pike <r@golang.org>
|
||||
pkg text/template/parse, type DotNode struct, embedded NodeType
|
||||
pkg text/template/parse, type NilNode struct, embedded NodeType
|
||||
pkg text/template/parse, method (*BranchNode) Copy() Node
|
||||
pkg text/template/parse, method (*IdentifierNode) SetTree(*Tree) *IdentifierNode
|
||||
pkg html/template, type Error struct, Node parse.Node
|
||||
|
||||
# CL 127470043 unicode: strconv: regexp: Upgrade to Unicode 7.0.0., Marcel van Lohuizen <mpvl@golang.org>
|
||||
pkg unicode, const Version = "7.0.0"
|
||||
pkg unicode, var Bassa_Vah *RangeTable
|
||||
pkg unicode, var Caucasian_Albanian *RangeTable
|
||||
pkg unicode, var Duployan *RangeTable
|
||||
pkg unicode, var Elbasan *RangeTable
|
||||
pkg unicode, var Grantha *RangeTable
|
||||
pkg unicode, var Khojki *RangeTable
|
||||
pkg unicode, var Khudawadi *RangeTable
|
||||
pkg unicode, var Linear_A *RangeTable
|
||||
pkg unicode, var Mahajani *RangeTable
|
||||
pkg unicode, var Manichaean *RangeTable
|
||||
pkg unicode, var Mende_Kikakui *RangeTable
|
||||
pkg unicode, var Modi *RangeTable
|
||||
pkg unicode, var Mro *RangeTable
|
||||
pkg unicode, var Nabataean *RangeTable
|
||||
pkg unicode, var Old_North_Arabian *RangeTable
|
||||
pkg unicode, var Old_Permic *RangeTable
|
||||
pkg unicode, var Pahawh_Hmong *RangeTable
|
||||
pkg unicode, var Palmyrene *RangeTable
|
||||
pkg unicode, var Pau_Cin_Hau *RangeTable
|
||||
pkg unicode, var Psalter_Pahlavi *RangeTable
|
||||
pkg unicode, var Siddham *RangeTable
|
||||
pkg unicode, var Tirhuta *RangeTable
|
||||
pkg unicode, var Warang_Citi *RangeTable
|
||||
975
api/go1.5.txt
975
api/go1.5.txt
@@ -1,975 +0,0 @@
|
||||
pkg archive/zip, method (*Writer) SetOffset(int64)
|
||||
pkg bufio, method (*Reader) Discard(int) (int, error)
|
||||
pkg bufio, method (ReadWriter) Discard(int) (int, error)
|
||||
pkg bytes, func LastIndexByte([]uint8, uint8) int
|
||||
pkg bytes, method (*Buffer) Cap() int
|
||||
pkg bytes, method (*Reader) Size() int64
|
||||
pkg crypto, const SHA512_224 = 14
|
||||
pkg crypto, const SHA512_224 Hash
|
||||
pkg crypto, const SHA512_256 = 15
|
||||
pkg crypto, const SHA512_256 Hash
|
||||
pkg crypto, type Decrypter interface { Decrypt, Public }
|
||||
pkg crypto, type Decrypter interface, Decrypt(io.Reader, []uint8, DecrypterOpts) ([]uint8, error)
|
||||
pkg crypto, type Decrypter interface, Public() PublicKey
|
||||
pkg crypto, type DecrypterOpts interface {}
|
||||
pkg crypto/cipher, func NewGCMWithNonceSize(Block, int) (AEAD, error)
|
||||
pkg crypto/elliptic, type CurveParams struct, Name string
|
||||
pkg crypto/rsa, method (*PrivateKey) Decrypt(io.Reader, []uint8, crypto.DecrypterOpts) ([]uint8, error)
|
||||
pkg crypto/rsa, type OAEPOptions struct
|
||||
pkg crypto/rsa, type OAEPOptions struct, Hash crypto.Hash
|
||||
pkg crypto/rsa, type OAEPOptions struct, Label []uint8
|
||||
pkg crypto/rsa, type PKCS1v15DecryptOptions struct
|
||||
pkg crypto/rsa, type PKCS1v15DecryptOptions struct, SessionKeyLen int
|
||||
pkg crypto/sha512, const Size224 = 28
|
||||
pkg crypto/sha512, const Size224 ideal-int
|
||||
pkg crypto/sha512, const Size256 = 32
|
||||
pkg crypto/sha512, const Size256 ideal-int
|
||||
pkg crypto/sha512, func New512_224() hash.Hash
|
||||
pkg crypto/sha512, func New512_256() hash.Hash
|
||||
pkg crypto/sha512, func Sum512_224([]uint8) [28]uint8
|
||||
pkg crypto/sha512, func Sum512_256([]uint8) [32]uint8
|
||||
pkg crypto/tls, const TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = 49196
|
||||
pkg crypto/tls, const TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16
|
||||
pkg crypto/tls, const TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = 49200
|
||||
pkg crypto/tls, const TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16
|
||||
pkg crypto/tls, method (*Config) SetSessionTicketKeys([][32]uint8)
|
||||
pkg crypto/tls, type Certificate struct, SignedCertificateTimestamps [][]uint8
|
||||
pkg crypto/tls, type ConnectionState struct, OCSPResponse []uint8
|
||||
pkg crypto/tls, type ConnectionState struct, SignedCertificateTimestamps [][]uint8
|
||||
pkg crypto/x509, method (*CertificateRequest) CheckSignature() error
|
||||
pkg crypto/x509, type Certificate struct, UnhandledCriticalExtensions []asn1.ObjectIdentifier
|
||||
pkg crypto/x509/pkix, type Name struct, ExtraNames []AttributeTypeAndValue
|
||||
pkg database/sql, method (*DB) Stats() DBStats
|
||||
pkg database/sql, type DBStats struct
|
||||
pkg database/sql, type DBStats struct, OpenConnections int
|
||||
pkg debug/dwarf, const ClassAddress = 1
|
||||
pkg debug/dwarf, const ClassAddress Class
|
||||
pkg debug/dwarf, const ClassBlock = 2
|
||||
pkg debug/dwarf, const ClassBlock Class
|
||||
pkg debug/dwarf, const ClassConstant = 3
|
||||
pkg debug/dwarf, const ClassConstant Class
|
||||
pkg debug/dwarf, const ClassExprLoc = 4
|
||||
pkg debug/dwarf, const ClassExprLoc Class
|
||||
pkg debug/dwarf, const ClassFlag = 5
|
||||
pkg debug/dwarf, const ClassFlag Class
|
||||
pkg debug/dwarf, const ClassLinePtr = 6
|
||||
pkg debug/dwarf, const ClassLinePtr Class
|
||||
pkg debug/dwarf, const ClassLocListPtr = 7
|
||||
pkg debug/dwarf, const ClassLocListPtr Class
|
||||
pkg debug/dwarf, const ClassMacPtr = 8
|
||||
pkg debug/dwarf, const ClassMacPtr Class
|
||||
pkg debug/dwarf, const ClassRangeListPtr = 9
|
||||
pkg debug/dwarf, const ClassRangeListPtr Class
|
||||
pkg debug/dwarf, const ClassReference = 10
|
||||
pkg debug/dwarf, const ClassReference Class
|
||||
pkg debug/dwarf, const ClassReferenceAlt = 13
|
||||
pkg debug/dwarf, const ClassReferenceAlt Class
|
||||
pkg debug/dwarf, const ClassReferenceSig = 11
|
||||
pkg debug/dwarf, const ClassReferenceSig Class
|
||||
pkg debug/dwarf, const ClassString = 12
|
||||
pkg debug/dwarf, const ClassString Class
|
||||
pkg debug/dwarf, const ClassStringAlt = 14
|
||||
pkg debug/dwarf, const ClassStringAlt Class
|
||||
pkg debug/dwarf, method (*Data) LineReader(*Entry) (*LineReader, error)
|
||||
pkg debug/dwarf, method (*Entry) AttrField(Attr) *Field
|
||||
pkg debug/dwarf, method (*LineReader) Next(*LineEntry) error
|
||||
pkg debug/dwarf, method (*LineReader) Reset()
|
||||
pkg debug/dwarf, method (*LineReader) Seek(LineReaderPos)
|
||||
pkg debug/dwarf, method (*LineReader) SeekPC(uint64, *LineEntry) error
|
||||
pkg debug/dwarf, method (*LineReader) Tell() LineReaderPos
|
||||
pkg debug/dwarf, method (*Reader) AddressSize() int
|
||||
pkg debug/dwarf, method (Class) GoString() string
|
||||
pkg debug/dwarf, method (Class) String() string
|
||||
pkg debug/dwarf, type Class int
|
||||
pkg debug/dwarf, type Field struct, Class Class
|
||||
pkg debug/dwarf, type LineEntry struct
|
||||
pkg debug/dwarf, type LineEntry struct, Address uint64
|
||||
pkg debug/dwarf, type LineEntry struct, BasicBlock bool
|
||||
pkg debug/dwarf, type LineEntry struct, Column int
|
||||
pkg debug/dwarf, type LineEntry struct, Discriminator int
|
||||
pkg debug/dwarf, type LineEntry struct, EndSequence bool
|
||||
pkg debug/dwarf, type LineEntry struct, EpilogueBegin bool
|
||||
pkg debug/dwarf, type LineEntry struct, File *LineFile
|
||||
pkg debug/dwarf, type LineEntry struct, ISA int
|
||||
pkg debug/dwarf, type LineEntry struct, IsStmt bool
|
||||
pkg debug/dwarf, type LineEntry struct, Line int
|
||||
pkg debug/dwarf, type LineEntry struct, OpIndex int
|
||||
pkg debug/dwarf, type LineEntry struct, PrologueEnd bool
|
||||
pkg debug/dwarf, type LineFile struct
|
||||
pkg debug/dwarf, type LineFile struct, Length int
|
||||
pkg debug/dwarf, type LineFile struct, Mtime uint64
|
||||
pkg debug/dwarf, type LineFile struct, Name string
|
||||
pkg debug/dwarf, type LineReader struct
|
||||
pkg debug/dwarf, type LineReaderPos struct
|
||||
pkg debug/dwarf, var ErrUnknownPC error
|
||||
pkg debug/elf, const R_PPC64_ADDR14 = 7
|
||||
pkg debug/elf, const R_PPC64_ADDR14 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR14_BRNTAKEN = 9
|
||||
pkg debug/elf, const R_PPC64_ADDR14_BRNTAKEN R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR14_BRTAKEN = 8
|
||||
pkg debug/elf, const R_PPC64_ADDR14_BRTAKEN R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16 = 3
|
||||
pkg debug/elf, const R_PPC64_ADDR16 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_DS = 56
|
||||
pkg debug/elf, const R_PPC64_ADDR16_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HA = 6
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HI = 5
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HIGHER = 39
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HIGHER R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HIGHERA = 40
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HIGHERA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HIGHEST = 41
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HIGHEST R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HIGHESTA = 42
|
||||
pkg debug/elf, const R_PPC64_ADDR16_HIGHESTA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_LO = 4
|
||||
pkg debug/elf, const R_PPC64_ADDR16_LO R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR16_LO_DS = 57
|
||||
pkg debug/elf, const R_PPC64_ADDR16_LO_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR24 = 2
|
||||
pkg debug/elf, const R_PPC64_ADDR24 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR32 = 1
|
||||
pkg debug/elf, const R_PPC64_ADDR32 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_ADDR64 = 38
|
||||
pkg debug/elf, const R_PPC64_ADDR64 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPMOD64 = 68
|
||||
pkg debug/elf, const R_PPC64_DTPMOD64 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16 = 74
|
||||
pkg debug/elf, const R_PPC64_DTPREL16 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_DS = 101
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HA = 77
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HI = 76
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HIGHER = 103
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HIGHER R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HIGHERA = 104
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HIGHERA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HIGHEST = 105
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HIGHEST R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HIGHESTA = 106
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_HIGHESTA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_LO = 75
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_LO R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_LO_DS = 102
|
||||
pkg debug/elf, const R_PPC64_DTPREL16_LO_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_DTPREL64 = 78
|
||||
pkg debug/elf, const R_PPC64_DTPREL64 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT16 = 14
|
||||
pkg debug/elf, const R_PPC64_GOT16 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT16_DS = 58
|
||||
pkg debug/elf, const R_PPC64_GOT16_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT16_HA = 17
|
||||
pkg debug/elf, const R_PPC64_GOT16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT16_HI = 16
|
||||
pkg debug/elf, const R_PPC64_GOT16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT16_LO = 15
|
||||
pkg debug/elf, const R_PPC64_GOT16_LO R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT16_LO_DS = 59
|
||||
pkg debug/elf, const R_PPC64_GOT16_LO_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_DTPREL16_DS = 91
|
||||
pkg debug/elf, const R_PPC64_GOT_DTPREL16_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_DTPREL16_HA = 94
|
||||
pkg debug/elf, const R_PPC64_GOT_DTPREL16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_DTPREL16_HI = 93
|
||||
pkg debug/elf, const R_PPC64_GOT_DTPREL16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_DTPREL16_LO_DS = 92
|
||||
pkg debug/elf, const R_PPC64_GOT_DTPREL16_LO_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSGD16 = 79
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSGD16 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSGD16_HA = 82
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSGD16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSGD16_HI = 81
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSGD16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSGD16_LO = 80
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSGD16_LO R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSLD16 = 83
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSLD16 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSLD16_HA = 86
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSLD16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSLD16_HI = 85
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSLD16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSLD16_LO = 84
|
||||
pkg debug/elf, const R_PPC64_GOT_TLSLD16_LO R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TPREL16_DS = 87
|
||||
pkg debug/elf, const R_PPC64_GOT_TPREL16_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TPREL16_HA = 90
|
||||
pkg debug/elf, const R_PPC64_GOT_TPREL16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TPREL16_HI = 89
|
||||
pkg debug/elf, const R_PPC64_GOT_TPREL16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_GOT_TPREL16_LO_DS = 88
|
||||
pkg debug/elf, const R_PPC64_GOT_TPREL16_LO_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_JMP_SLOT = 21
|
||||
pkg debug/elf, const R_PPC64_JMP_SLOT R_PPC64
|
||||
pkg debug/elf, const R_PPC64_NONE = 0
|
||||
pkg debug/elf, const R_PPC64_NONE R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL14 = 11
|
||||
pkg debug/elf, const R_PPC64_REL14 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL14_BRNTAKEN = 13
|
||||
pkg debug/elf, const R_PPC64_REL14_BRNTAKEN R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL14_BRTAKEN = 12
|
||||
pkg debug/elf, const R_PPC64_REL14_BRTAKEN R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL16 = 249
|
||||
pkg debug/elf, const R_PPC64_REL16 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL16_HA = 252
|
||||
pkg debug/elf, const R_PPC64_REL16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL16_HI = 251
|
||||
pkg debug/elf, const R_PPC64_REL16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL16_LO = 250
|
||||
pkg debug/elf, const R_PPC64_REL16_LO R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL24 = 10
|
||||
pkg debug/elf, const R_PPC64_REL24 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL32 = 26
|
||||
pkg debug/elf, const R_PPC64_REL32 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_REL64 = 44
|
||||
pkg debug/elf, const R_PPC64_REL64 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TLS = 67
|
||||
pkg debug/elf, const R_PPC64_TLS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TLSGD = 107
|
||||
pkg debug/elf, const R_PPC64_TLSGD R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TLSLD = 108
|
||||
pkg debug/elf, const R_PPC64_TLSLD R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TOC = 51
|
||||
pkg debug/elf, const R_PPC64_TOC R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TOC16 = 47
|
||||
pkg debug/elf, const R_PPC64_TOC16 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TOC16_DS = 63
|
||||
pkg debug/elf, const R_PPC64_TOC16_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TOC16_HA = 50
|
||||
pkg debug/elf, const R_PPC64_TOC16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TOC16_HI = 49
|
||||
pkg debug/elf, const R_PPC64_TOC16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TOC16_LO = 48
|
||||
pkg debug/elf, const R_PPC64_TOC16_LO R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TOC16_LO_DS = 64
|
||||
pkg debug/elf, const R_PPC64_TOC16_LO_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16 = 69
|
||||
pkg debug/elf, const R_PPC64_TPREL16 R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_DS = 95
|
||||
pkg debug/elf, const R_PPC64_TPREL16_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HA = 72
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HI = 71
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HI R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HIGHER = 97
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HIGHER R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HIGHERA = 98
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HIGHERA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HIGHEST = 99
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HIGHEST R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HIGHESTA = 100
|
||||
pkg debug/elf, const R_PPC64_TPREL16_HIGHESTA R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_LO = 70
|
||||
pkg debug/elf, const R_PPC64_TPREL16_LO R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL16_LO_DS = 96
|
||||
pkg debug/elf, const R_PPC64_TPREL16_LO_DS R_PPC64
|
||||
pkg debug/elf, const R_PPC64_TPREL64 = 73
|
||||
pkg debug/elf, const R_PPC64_TPREL64 R_PPC64
|
||||
pkg debug/elf, method (R_PPC64) GoString() string
|
||||
pkg debug/elf, method (R_PPC64) String() string
|
||||
pkg debug/elf, type R_PPC64 int
|
||||
pkg encoding/base64, const NoPadding = -1
|
||||
pkg encoding/base64, const NoPadding int32
|
||||
pkg encoding/base64, const StdPadding = 61
|
||||
pkg encoding/base64, const StdPadding int32
|
||||
pkg encoding/base64, method (Encoding) WithPadding(int32) *Encoding
|
||||
pkg encoding/base64, var RawStdEncoding *Encoding
|
||||
pkg encoding/base64, var RawURLEncoding *Encoding
|
||||
pkg encoding/json, method (*Decoder) More() bool
|
||||
pkg encoding/json, method (*Decoder) Token() (Token, error)
|
||||
pkg encoding/json, method (Delim) String() string
|
||||
pkg encoding/json, type Delim int32
|
||||
pkg encoding/json, type Token interface {}
|
||||
pkg encoding/json, type UnmarshalTypeError struct, Offset int64
|
||||
pkg flag, func UnquoteUsage(*Flag) (string, string)
|
||||
pkg go/ast, type EmptyStmt struct, Implicit bool
|
||||
pkg go/build, type Package struct, PkgTargetRoot string
|
||||
pkg go/constant, const Bool = 1
|
||||
pkg go/constant, const Bool Kind
|
||||
pkg go/constant, const Complex = 5
|
||||
pkg go/constant, const Complex Kind
|
||||
pkg go/constant, const Float = 4
|
||||
pkg go/constant, const Float Kind
|
||||
pkg go/constant, const Int = 3
|
||||
pkg go/constant, const Int Kind
|
||||
pkg go/constant, const String = 2
|
||||
pkg go/constant, const String Kind
|
||||
pkg go/constant, const Unknown = 0
|
||||
pkg go/constant, const Unknown Kind
|
||||
pkg go/constant, func BinaryOp(Value, token.Token, Value) Value
|
||||
pkg go/constant, func BitLen(Value) int
|
||||
pkg go/constant, func BoolVal(Value) bool
|
||||
pkg go/constant, func Bytes(Value) []uint8
|
||||
pkg go/constant, func Compare(Value, token.Token, Value) bool
|
||||
pkg go/constant, func Denom(Value) Value
|
||||
pkg go/constant, func Float32Val(Value) (float32, bool)
|
||||
pkg go/constant, func Float64Val(Value) (float64, bool)
|
||||
pkg go/constant, func Imag(Value) Value
|
||||
pkg go/constant, func Int64Val(Value) (int64, bool)
|
||||
pkg go/constant, func MakeBool(bool) Value
|
||||
pkg go/constant, func MakeFloat64(float64) Value
|
||||
pkg go/constant, func MakeFromBytes([]uint8) Value
|
||||
pkg go/constant, func MakeFromLiteral(string, token.Token, uint) Value
|
||||
pkg go/constant, func MakeImag(Value) Value
|
||||
pkg go/constant, func MakeInt64(int64) Value
|
||||
pkg go/constant, func MakeString(string) Value
|
||||
pkg go/constant, func MakeUint64(uint64) Value
|
||||
pkg go/constant, func MakeUnknown() Value
|
||||
pkg go/constant, func Num(Value) Value
|
||||
pkg go/constant, func Real(Value) Value
|
||||
pkg go/constant, func Shift(Value, token.Token, uint) Value
|
||||
pkg go/constant, func Sign(Value) int
|
||||
pkg go/constant, func StringVal(Value) string
|
||||
pkg go/constant, func Uint64Val(Value) (uint64, bool)
|
||||
pkg go/constant, func UnaryOp(token.Token, Value, uint) Value
|
||||
pkg go/constant, type Kind int
|
||||
pkg go/constant, type Value interface, Kind() Kind
|
||||
pkg go/constant, type Value interface, String() string
|
||||
pkg go/constant, type Value interface, unexported methods
|
||||
pkg go/importer, func Default() types.Importer
|
||||
pkg go/importer, func For(string, Lookup) types.Importer
|
||||
pkg go/importer, type Lookup func(string) (io.ReadCloser, error)
|
||||
pkg go/parser, func ParseExprFrom(*token.FileSet, string, interface{}, Mode) (ast.Expr, error)
|
||||
pkg go/types, const Bool = 1
|
||||
pkg go/types, const Bool BasicKind
|
||||
pkg go/types, const Byte = 8
|
||||
pkg go/types, const Byte BasicKind
|
||||
pkg go/types, const Complex128 = 16
|
||||
pkg go/types, const Complex128 BasicKind
|
||||
pkg go/types, const Complex64 = 15
|
||||
pkg go/types, const Complex64 BasicKind
|
||||
pkg go/types, const FieldVal = 0
|
||||
pkg go/types, const FieldVal SelectionKind
|
||||
pkg go/types, const Float32 = 13
|
||||
pkg go/types, const Float32 BasicKind
|
||||
pkg go/types, const Float64 = 14
|
||||
pkg go/types, const Float64 BasicKind
|
||||
pkg go/types, const Int = 2
|
||||
pkg go/types, const Int BasicKind
|
||||
pkg go/types, const Int16 = 4
|
||||
pkg go/types, const Int16 BasicKind
|
||||
pkg go/types, const Int32 = 5
|
||||
pkg go/types, const Int32 BasicKind
|
||||
pkg go/types, const Int64 = 6
|
||||
pkg go/types, const Int64 BasicKind
|
||||
pkg go/types, const Int8 = 3
|
||||
pkg go/types, const Int8 BasicKind
|
||||
pkg go/types, const Invalid = 0
|
||||
pkg go/types, const Invalid BasicKind
|
||||
pkg go/types, const IsBoolean = 1
|
||||
pkg go/types, const IsBoolean BasicInfo
|
||||
pkg go/types, const IsComplex = 16
|
||||
pkg go/types, const IsComplex BasicInfo
|
||||
pkg go/types, const IsConstType = 59
|
||||
pkg go/types, const IsConstType BasicInfo
|
||||
pkg go/types, const IsFloat = 8
|
||||
pkg go/types, const IsFloat BasicInfo
|
||||
pkg go/types, const IsInteger = 2
|
||||
pkg go/types, const IsInteger BasicInfo
|
||||
pkg go/types, const IsNumeric = 26
|
||||
pkg go/types, const IsNumeric BasicInfo
|
||||
pkg go/types, const IsOrdered = 42
|
||||
pkg go/types, const IsOrdered BasicInfo
|
||||
pkg go/types, const IsString = 32
|
||||
pkg go/types, const IsString BasicInfo
|
||||
pkg go/types, const IsUnsigned = 4
|
||||
pkg go/types, const IsUnsigned BasicInfo
|
||||
pkg go/types, const IsUntyped = 64
|
||||
pkg go/types, const IsUntyped BasicInfo
|
||||
pkg go/types, const MethodExpr = 2
|
||||
pkg go/types, const MethodExpr SelectionKind
|
||||
pkg go/types, const MethodVal = 1
|
||||
pkg go/types, const MethodVal SelectionKind
|
||||
pkg go/types, const RecvOnly = 2
|
||||
pkg go/types, const RecvOnly ChanDir
|
||||
pkg go/types, const Rune = 5
|
||||
pkg go/types, const Rune BasicKind
|
||||
pkg go/types, const SendOnly = 1
|
||||
pkg go/types, const SendOnly ChanDir
|
||||
pkg go/types, const SendRecv = 0
|
||||
pkg go/types, const SendRecv ChanDir
|
||||
pkg go/types, const String = 17
|
||||
pkg go/types, const String BasicKind
|
||||
pkg go/types, const Uint = 7
|
||||
pkg go/types, const Uint BasicKind
|
||||
pkg go/types, const Uint16 = 9
|
||||
pkg go/types, const Uint16 BasicKind
|
||||
pkg go/types, const Uint32 = 10
|
||||
pkg go/types, const Uint32 BasicKind
|
||||
pkg go/types, const Uint64 = 11
|
||||
pkg go/types, const Uint64 BasicKind
|
||||
pkg go/types, const Uint8 = 8
|
||||
pkg go/types, const Uint8 BasicKind
|
||||
pkg go/types, const Uintptr = 12
|
||||
pkg go/types, const Uintptr BasicKind
|
||||
pkg go/types, const UnsafePointer = 18
|
||||
pkg go/types, const UnsafePointer BasicKind
|
||||
pkg go/types, const UntypedBool = 19
|
||||
pkg go/types, const UntypedBool BasicKind
|
||||
pkg go/types, const UntypedComplex = 23
|
||||
pkg go/types, const UntypedComplex BasicKind
|
||||
pkg go/types, const UntypedFloat = 22
|
||||
pkg go/types, const UntypedFloat BasicKind
|
||||
pkg go/types, const UntypedInt = 20
|
||||
pkg go/types, const UntypedInt BasicKind
|
||||
pkg go/types, const UntypedNil = 25
|
||||
pkg go/types, const UntypedNil BasicKind
|
||||
pkg go/types, const UntypedRune = 21
|
||||
pkg go/types, const UntypedRune BasicKind
|
||||
pkg go/types, const UntypedString = 24
|
||||
pkg go/types, const UntypedString BasicKind
|
||||
pkg go/types, func AssertableTo(*Interface, Type) bool
|
||||
pkg go/types, func AssignableTo(Type, Type) bool
|
||||
pkg go/types, func Comparable(Type) bool
|
||||
pkg go/types, func ConvertibleTo(Type, Type) bool
|
||||
pkg go/types, func DefPredeclaredTestFuncs()
|
||||
pkg go/types, func Eval(*token.FileSet, *Package, token.Pos, string) (TypeAndValue, error)
|
||||
pkg go/types, func ExprString(ast.Expr) string
|
||||
pkg go/types, func Id(*Package, string) string
|
||||
pkg go/types, func Identical(Type, Type) bool
|
||||
pkg go/types, func Implements(Type, *Interface) bool
|
||||
pkg go/types, func IsInterface(Type) bool
|
||||
pkg go/types, func LookupFieldOrMethod(Type, bool, *Package, string) (Object, []int, bool)
|
||||
pkg go/types, func MissingMethod(Type, *Interface, bool) (*Func, bool)
|
||||
pkg go/types, func NewArray(Type, int64) *Array
|
||||
pkg go/types, func NewChan(ChanDir, Type) *Chan
|
||||
pkg go/types, func NewChecker(*Config, *token.FileSet, *Package, *Info) *Checker
|
||||
pkg go/types, func NewConst(token.Pos, *Package, string, Type, constant.Value) *Const
|
||||
pkg go/types, func NewField(token.Pos, *Package, string, Type, bool) *Var
|
||||
pkg go/types, func NewFunc(token.Pos, *Package, string, *Signature) *Func
|
||||
pkg go/types, func NewInterface([]*Func, []*Named) *Interface
|
||||
pkg go/types, func NewLabel(token.Pos, *Package, string) *Label
|
||||
pkg go/types, func NewMap(Type, Type) *Map
|
||||
pkg go/types, func NewMethodSet(Type) *MethodSet
|
||||
pkg go/types, func NewNamed(*TypeName, Type, []*Func) *Named
|
||||
pkg go/types, func NewPackage(string, string) *Package
|
||||
pkg go/types, func NewParam(token.Pos, *Package, string, Type) *Var
|
||||
pkg go/types, func NewPkgName(token.Pos, *Package, string, *Package) *PkgName
|
||||
pkg go/types, func NewPointer(Type) *Pointer
|
||||
pkg go/types, func NewScope(*Scope, token.Pos, token.Pos, string) *Scope
|
||||
pkg go/types, func NewSignature(*Var, *Tuple, *Tuple, bool) *Signature
|
||||
pkg go/types, func NewSlice(Type) *Slice
|
||||
pkg go/types, func NewStruct([]*Var, []string) *Struct
|
||||
pkg go/types, func NewTuple(...*Var) *Tuple
|
||||
pkg go/types, func NewTypeName(token.Pos, *Package, string, Type) *TypeName
|
||||
pkg go/types, func NewVar(token.Pos, *Package, string, Type) *Var
|
||||
pkg go/types, func ObjectString(Object, Qualifier) string
|
||||
pkg go/types, func RelativeTo(*Package) Qualifier
|
||||
pkg go/types, func SelectionString(*Selection, Qualifier) string
|
||||
pkg go/types, func TypeString(Type, Qualifier) string
|
||||
pkg go/types, func WriteExpr(*bytes.Buffer, ast.Expr)
|
||||
pkg go/types, func WriteSignature(*bytes.Buffer, *Signature, Qualifier)
|
||||
pkg go/types, func WriteType(*bytes.Buffer, Type, Qualifier)
|
||||
pkg go/types, method (*Array) Elem() Type
|
||||
pkg go/types, method (*Array) Len() int64
|
||||
pkg go/types, method (*Array) String() string
|
||||
pkg go/types, method (*Array) Underlying() Type
|
||||
pkg go/types, method (*Basic) Info() BasicInfo
|
||||
pkg go/types, method (*Basic) Kind() BasicKind
|
||||
pkg go/types, method (*Basic) Name() string
|
||||
pkg go/types, method (*Basic) String() string
|
||||
pkg go/types, method (*Basic) Underlying() Type
|
||||
pkg go/types, method (*Builtin) Exported() bool
|
||||
pkg go/types, method (*Builtin) Id() string
|
||||
pkg go/types, method (*Builtin) Name() string
|
||||
pkg go/types, method (*Builtin) Parent() *Scope
|
||||
pkg go/types, method (*Builtin) Pkg() *Package
|
||||
pkg go/types, method (*Builtin) Pos() token.Pos
|
||||
pkg go/types, method (*Builtin) String() string
|
||||
pkg go/types, method (*Builtin) Type() Type
|
||||
pkg go/types, method (*Chan) Dir() ChanDir
|
||||
pkg go/types, method (*Chan) Elem() Type
|
||||
pkg go/types, method (*Chan) String() string
|
||||
pkg go/types, method (*Chan) Underlying() Type
|
||||
pkg go/types, method (*Checker) Files([]*ast.File) error
|
||||
pkg go/types, method (*Config) Check(string, *token.FileSet, []*ast.File, *Info) (*Package, error)
|
||||
pkg go/types, method (*Const) Exported() bool
|
||||
pkg go/types, method (*Const) Id() string
|
||||
pkg go/types, method (*Const) Name() string
|
||||
pkg go/types, method (*Const) Parent() *Scope
|
||||
pkg go/types, method (*Const) Pkg() *Package
|
||||
pkg go/types, method (*Const) Pos() token.Pos
|
||||
pkg go/types, method (*Const) String() string
|
||||
pkg go/types, method (*Const) Type() Type
|
||||
pkg go/types, method (*Const) Val() constant.Value
|
||||
pkg go/types, method (*Func) Exported() bool
|
||||
pkg go/types, method (*Func) FullName() string
|
||||
pkg go/types, method (*Func) Id() string
|
||||
pkg go/types, method (*Func) Name() string
|
||||
pkg go/types, method (*Func) Parent() *Scope
|
||||
pkg go/types, method (*Func) Pkg() *Package
|
||||
pkg go/types, method (*Func) Pos() token.Pos
|
||||
pkg go/types, method (*Func) Scope() *Scope
|
||||
pkg go/types, method (*Func) String() string
|
||||
pkg go/types, method (*Func) Type() Type
|
||||
pkg go/types, method (*Info) ObjectOf(*ast.Ident) Object
|
||||
pkg go/types, method (*Info) TypeOf(ast.Expr) Type
|
||||
pkg go/types, method (*Initializer) String() string
|
||||
pkg go/types, method (*Interface) Complete() *Interface
|
||||
pkg go/types, method (*Interface) Embedded(int) *Named
|
||||
pkg go/types, method (*Interface) Empty() bool
|
||||
pkg go/types, method (*Interface) ExplicitMethod(int) *Func
|
||||
pkg go/types, method (*Interface) Method(int) *Func
|
||||
pkg go/types, method (*Interface) NumEmbeddeds() int
|
||||
pkg go/types, method (*Interface) NumExplicitMethods() int
|
||||
pkg go/types, method (*Interface) NumMethods() int
|
||||
pkg go/types, method (*Interface) String() string
|
||||
pkg go/types, method (*Interface) Underlying() Type
|
||||
pkg go/types, method (*Label) Exported() bool
|
||||
pkg go/types, method (*Label) Id() string
|
||||
pkg go/types, method (*Label) Name() string
|
||||
pkg go/types, method (*Label) Parent() *Scope
|
||||
pkg go/types, method (*Label) Pkg() *Package
|
||||
pkg go/types, method (*Label) Pos() token.Pos
|
||||
pkg go/types, method (*Label) String() string
|
||||
pkg go/types, method (*Label) Type() Type
|
||||
pkg go/types, method (*Map) Elem() Type
|
||||
pkg go/types, method (*Map) Key() Type
|
||||
pkg go/types, method (*Map) String() string
|
||||
pkg go/types, method (*Map) Underlying() Type
|
||||
pkg go/types, method (*MethodSet) At(int) *Selection
|
||||
pkg go/types, method (*MethodSet) Len() int
|
||||
pkg go/types, method (*MethodSet) Lookup(*Package, string) *Selection
|
||||
pkg go/types, method (*MethodSet) String() string
|
||||
pkg go/types, method (*Named) AddMethod(*Func)
|
||||
pkg go/types, method (*Named) Method(int) *Func
|
||||
pkg go/types, method (*Named) NumMethods() int
|
||||
pkg go/types, method (*Named) Obj() *TypeName
|
||||
pkg go/types, method (*Named) SetUnderlying(Type)
|
||||
pkg go/types, method (*Named) String() string
|
||||
pkg go/types, method (*Named) Underlying() Type
|
||||
pkg go/types, method (*Nil) Exported() bool
|
||||
pkg go/types, method (*Nil) Id() string
|
||||
pkg go/types, method (*Nil) Name() string
|
||||
pkg go/types, method (*Nil) Parent() *Scope
|
||||
pkg go/types, method (*Nil) Pkg() *Package
|
||||
pkg go/types, method (*Nil) Pos() token.Pos
|
||||
pkg go/types, method (*Nil) String() string
|
||||
pkg go/types, method (*Nil) Type() Type
|
||||
pkg go/types, method (*Package) Complete() bool
|
||||
pkg go/types, method (*Package) Imports() []*Package
|
||||
pkg go/types, method (*Package) MarkComplete()
|
||||
pkg go/types, method (*Package) Name() string
|
||||
pkg go/types, method (*Package) Path() string
|
||||
pkg go/types, method (*Package) Scope() *Scope
|
||||
pkg go/types, method (*Package) SetImports([]*Package)
|
||||
pkg go/types, method (*Package) String() string
|
||||
pkg go/types, method (*PkgName) Exported() bool
|
||||
pkg go/types, method (*PkgName) Id() string
|
||||
pkg go/types, method (*PkgName) Imported() *Package
|
||||
pkg go/types, method (*PkgName) Name() string
|
||||
pkg go/types, method (*PkgName) Parent() *Scope
|
||||
pkg go/types, method (*PkgName) Pkg() *Package
|
||||
pkg go/types, method (*PkgName) Pos() token.Pos
|
||||
pkg go/types, method (*PkgName) String() string
|
||||
pkg go/types, method (*PkgName) Type() Type
|
||||
pkg go/types, method (*Pointer) Elem() Type
|
||||
pkg go/types, method (*Pointer) String() string
|
||||
pkg go/types, method (*Pointer) Underlying() Type
|
||||
pkg go/types, method (*Scope) Child(int) *Scope
|
||||
pkg go/types, method (*Scope) Contains(token.Pos) bool
|
||||
pkg go/types, method (*Scope) End() token.Pos
|
||||
pkg go/types, method (*Scope) Innermost(token.Pos) *Scope
|
||||
pkg go/types, method (*Scope) Insert(Object) Object
|
||||
pkg go/types, method (*Scope) Len() int
|
||||
pkg go/types, method (*Scope) Lookup(string) Object
|
||||
pkg go/types, method (*Scope) LookupParent(string, token.Pos) (*Scope, Object)
|
||||
pkg go/types, method (*Scope) Names() []string
|
||||
pkg go/types, method (*Scope) NumChildren() int
|
||||
pkg go/types, method (*Scope) Parent() *Scope
|
||||
pkg go/types, method (*Scope) Pos() token.Pos
|
||||
pkg go/types, method (*Scope) String() string
|
||||
pkg go/types, method (*Scope) WriteTo(io.Writer, int, bool)
|
||||
pkg go/types, method (*Selection) Index() []int
|
||||
pkg go/types, method (*Selection) Indirect() bool
|
||||
pkg go/types, method (*Selection) Kind() SelectionKind
|
||||
pkg go/types, method (*Selection) Obj() Object
|
||||
pkg go/types, method (*Selection) Recv() Type
|
||||
pkg go/types, method (*Selection) String() string
|
||||
pkg go/types, method (*Selection) Type() Type
|
||||
pkg go/types, method (*Signature) Params() *Tuple
|
||||
pkg go/types, method (*Signature) Recv() *Var
|
||||
pkg go/types, method (*Signature) Results() *Tuple
|
||||
pkg go/types, method (*Signature) String() string
|
||||
pkg go/types, method (*Signature) Underlying() Type
|
||||
pkg go/types, method (*Signature) Variadic() bool
|
||||
pkg go/types, method (*Slice) Elem() Type
|
||||
pkg go/types, method (*Slice) String() string
|
||||
pkg go/types, method (*Slice) Underlying() Type
|
||||
pkg go/types, method (*StdSizes) Alignof(Type) int64
|
||||
pkg go/types, method (*StdSizes) Offsetsof([]*Var) []int64
|
||||
pkg go/types, method (*StdSizes) Sizeof(Type) int64
|
||||
pkg go/types, method (*Struct) Field(int) *Var
|
||||
pkg go/types, method (*Struct) NumFields() int
|
||||
pkg go/types, method (*Struct) String() string
|
||||
pkg go/types, method (*Struct) Tag(int) string
|
||||
pkg go/types, method (*Struct) Underlying() Type
|
||||
pkg go/types, method (*Tuple) At(int) *Var
|
||||
pkg go/types, method (*Tuple) Len() int
|
||||
pkg go/types, method (*Tuple) String() string
|
||||
pkg go/types, method (*Tuple) Underlying() Type
|
||||
pkg go/types, method (*TypeName) Exported() bool
|
||||
pkg go/types, method (*TypeName) Id() string
|
||||
pkg go/types, method (*TypeName) Name() string
|
||||
pkg go/types, method (*TypeName) Parent() *Scope
|
||||
pkg go/types, method (*TypeName) Pkg() *Package
|
||||
pkg go/types, method (*TypeName) Pos() token.Pos
|
||||
pkg go/types, method (*TypeName) String() string
|
||||
pkg go/types, method (*TypeName) Type() Type
|
||||
pkg go/types, method (*Var) Anonymous() bool
|
||||
pkg go/types, method (*Var) Exported() bool
|
||||
pkg go/types, method (*Var) Id() string
|
||||
pkg go/types, method (*Var) IsField() bool
|
||||
pkg go/types, method (*Var) Name() string
|
||||
pkg go/types, method (*Var) Parent() *Scope
|
||||
pkg go/types, method (*Var) Pkg() *Package
|
||||
pkg go/types, method (*Var) Pos() token.Pos
|
||||
pkg go/types, method (*Var) String() string
|
||||
pkg go/types, method (*Var) Type() Type
|
||||
pkg go/types, method (Checker) ObjectOf(*ast.Ident) Object
|
||||
pkg go/types, method (Checker) TypeOf(ast.Expr) Type
|
||||
pkg go/types, method (Error) Error() string
|
||||
pkg go/types, method (TypeAndValue) Addressable() bool
|
||||
pkg go/types, method (TypeAndValue) Assignable() bool
|
||||
pkg go/types, method (TypeAndValue) HasOk() bool
|
||||
pkg go/types, method (TypeAndValue) IsBuiltin() bool
|
||||
pkg go/types, method (TypeAndValue) IsNil() bool
|
||||
pkg go/types, method (TypeAndValue) IsType() bool
|
||||
pkg go/types, method (TypeAndValue) IsValue() bool
|
||||
pkg go/types, method (TypeAndValue) IsVoid() bool
|
||||
pkg go/types, type Array struct
|
||||
pkg go/types, type Basic struct
|
||||
pkg go/types, type BasicInfo int
|
||||
pkg go/types, type BasicKind int
|
||||
pkg go/types, type Builtin struct
|
||||
pkg go/types, type Chan struct
|
||||
pkg go/types, type ChanDir int
|
||||
pkg go/types, type Checker struct
|
||||
pkg go/types, type Checker struct, embedded *Info
|
||||
pkg go/types, type Config struct
|
||||
pkg go/types, type Config struct, DisableUnusedImportCheck bool
|
||||
pkg go/types, type Config struct, Error func(error)
|
||||
pkg go/types, type Config struct, FakeImportC bool
|
||||
pkg go/types, type Config struct, IgnoreFuncBodies bool
|
||||
pkg go/types, type Config struct, Importer Importer
|
||||
pkg go/types, type Config struct, Sizes Sizes
|
||||
pkg go/types, type Const struct
|
||||
pkg go/types, type Error struct
|
||||
pkg go/types, type Error struct, Fset *token.FileSet
|
||||
pkg go/types, type Error struct, Msg string
|
||||
pkg go/types, type Error struct, Pos token.Pos
|
||||
pkg go/types, type Error struct, Soft bool
|
||||
pkg go/types, type Func struct
|
||||
pkg go/types, type Importer interface { Import }
|
||||
pkg go/types, type Importer interface, Import(string) (*Package, error)
|
||||
pkg go/types, type Info struct
|
||||
pkg go/types, type Info struct, Defs map[*ast.Ident]Object
|
||||
pkg go/types, type Info struct, Implicits map[ast.Node]Object
|
||||
pkg go/types, type Info struct, InitOrder []*Initializer
|
||||
pkg go/types, type Info struct, Scopes map[ast.Node]*Scope
|
||||
pkg go/types, type Info struct, Selections map[*ast.SelectorExpr]*Selection
|
||||
pkg go/types, type Info struct, Types map[ast.Expr]TypeAndValue
|
||||
pkg go/types, type Info struct, Uses map[*ast.Ident]Object
|
||||
pkg go/types, type Initializer struct
|
||||
pkg go/types, type Initializer struct, Lhs []*Var
|
||||
pkg go/types, type Initializer struct, Rhs ast.Expr
|
||||
pkg go/types, type Interface struct
|
||||
pkg go/types, type Label struct
|
||||
pkg go/types, type Map struct
|
||||
pkg go/types, type MethodSet struct
|
||||
pkg go/types, type Named struct
|
||||
pkg go/types, type Nil struct
|
||||
pkg go/types, type Object interface, Exported() bool
|
||||
pkg go/types, type Object interface, Id() string
|
||||
pkg go/types, type Object interface, Name() string
|
||||
pkg go/types, type Object interface, Parent() *Scope
|
||||
pkg go/types, type Object interface, Pkg() *Package
|
||||
pkg go/types, type Object interface, Pos() token.Pos
|
||||
pkg go/types, type Object interface, String() string
|
||||
pkg go/types, type Object interface, Type() Type
|
||||
pkg go/types, type Object interface, unexported methods
|
||||
pkg go/types, type Package struct
|
||||
pkg go/types, type PkgName struct
|
||||
pkg go/types, type Pointer struct
|
||||
pkg go/types, type Qualifier func(*Package) string
|
||||
pkg go/types, type Scope struct
|
||||
pkg go/types, type Selection struct
|
||||
pkg go/types, type SelectionKind int
|
||||
pkg go/types, type Signature struct
|
||||
pkg go/types, type Sizes interface { Alignof, Offsetsof, Sizeof }
|
||||
pkg go/types, type Sizes interface, Alignof(Type) int64
|
||||
pkg go/types, type Sizes interface, Offsetsof([]*Var) []int64
|
||||
pkg go/types, type Sizes interface, Sizeof(Type) int64
|
||||
pkg go/types, type Slice struct
|
||||
pkg go/types, type StdSizes struct
|
||||
pkg go/types, type StdSizes struct, MaxAlign int64
|
||||
pkg go/types, type StdSizes struct, WordSize int64
|
||||
pkg go/types, type Struct struct
|
||||
pkg go/types, type Tuple struct
|
||||
pkg go/types, type Type interface { String, Underlying }
|
||||
pkg go/types, type Type interface, String() string
|
||||
pkg go/types, type Type interface, Underlying() Type
|
||||
pkg go/types, type TypeAndValue struct
|
||||
pkg go/types, type TypeAndValue struct, Type Type
|
||||
pkg go/types, type TypeAndValue struct, Value constant.Value
|
||||
pkg go/types, type TypeName struct
|
||||
pkg go/types, type Var struct
|
||||
pkg go/types, var Typ []*Basic
|
||||
pkg go/types, var Universe *Scope
|
||||
pkg go/types, var Unsafe *Package
|
||||
pkg html/template, method (*Template) Option(...string) *Template
|
||||
pkg image, const YCbCrSubsampleRatio410 = 5
|
||||
pkg image, const YCbCrSubsampleRatio410 YCbCrSubsampleRatio
|
||||
pkg image, const YCbCrSubsampleRatio411 = 4
|
||||
pkg image, const YCbCrSubsampleRatio411 YCbCrSubsampleRatio
|
||||
pkg image, func NewCMYK(Rectangle) *CMYK
|
||||
pkg image, method (*CMYK) At(int, int) color.Color
|
||||
pkg image, method (*CMYK) Bounds() Rectangle
|
||||
pkg image, method (*CMYK) CMYKAt(int, int) color.CMYK
|
||||
pkg image, method (*CMYK) ColorModel() color.Model
|
||||
pkg image, method (*CMYK) Opaque() bool
|
||||
pkg image, method (*CMYK) PixOffset(int, int) int
|
||||
pkg image, method (*CMYK) Set(int, int, color.Color)
|
||||
pkg image, method (*CMYK) SetCMYK(int, int, color.CMYK)
|
||||
pkg image, method (*CMYK) SubImage(Rectangle) Image
|
||||
pkg image, method (Rectangle) At(int, int) color.Color
|
||||
pkg image, method (Rectangle) Bounds() Rectangle
|
||||
pkg image, method (Rectangle) ColorModel() color.Model
|
||||
pkg image, type CMYK struct
|
||||
pkg image, type CMYK struct, Pix []uint8
|
||||
pkg image, type CMYK struct, Rect Rectangle
|
||||
pkg image, type CMYK struct, Stride int
|
||||
pkg image/color, func CMYKToRGB(uint8, uint8, uint8, uint8) (uint8, uint8, uint8)
|
||||
pkg image/color, func RGBToCMYK(uint8, uint8, uint8) (uint8, uint8, uint8, uint8)
|
||||
pkg image/color, method (CMYK) RGBA() (uint32, uint32, uint32, uint32)
|
||||
pkg image/color, type CMYK struct
|
||||
pkg image/color, type CMYK struct, C uint8
|
||||
pkg image/color, type CMYK struct, K uint8
|
||||
pkg image/color, type CMYK struct, M uint8
|
||||
pkg image/color, type CMYK struct, Y uint8
|
||||
pkg image/color, var CMYKModel Model
|
||||
pkg image/gif, const DisposalBackground = 2
|
||||
pkg image/gif, const DisposalBackground ideal-int
|
||||
pkg image/gif, const DisposalNone = 1
|
||||
pkg image/gif, const DisposalNone ideal-int
|
||||
pkg image/gif, const DisposalPrevious = 3
|
||||
pkg image/gif, const DisposalPrevious ideal-int
|
||||
pkg image/gif, type GIF struct, BackgroundIndex uint8
|
||||
pkg image/gif, type GIF struct, Config image.Config
|
||||
pkg image/gif, type GIF struct, Disposal []uint8
|
||||
pkg io, func CopyBuffer(Writer, Reader, []uint8) (int64, error)
|
||||
pkg log, const LUTC = 32
|
||||
pkg log, const LUTC ideal-int
|
||||
pkg log, func Output(int, string) error
|
||||
pkg log, method (*Logger) SetOutput(io.Writer)
|
||||
pkg math/big, const Above = 1
|
||||
pkg math/big, const Above Accuracy
|
||||
pkg math/big, const AwayFromZero = 3
|
||||
pkg math/big, const AwayFromZero RoundingMode
|
||||
pkg math/big, const Below = -1
|
||||
pkg math/big, const Below Accuracy
|
||||
pkg math/big, const Exact = 0
|
||||
pkg math/big, const Exact Accuracy
|
||||
pkg math/big, const MaxExp = 2147483647
|
||||
pkg math/big, const MaxExp ideal-int
|
||||
pkg math/big, const MaxPrec = 4294967295
|
||||
pkg math/big, const MaxPrec ideal-int
|
||||
pkg math/big, const MinExp = -2147483648
|
||||
pkg math/big, const MinExp ideal-int
|
||||
pkg math/big, const ToNearestAway = 1
|
||||
pkg math/big, const ToNearestAway RoundingMode
|
||||
pkg math/big, const ToNearestEven = 0
|
||||
pkg math/big, const ToNearestEven RoundingMode
|
||||
pkg math/big, const ToNegativeInf = 4
|
||||
pkg math/big, const ToNegativeInf RoundingMode
|
||||
pkg math/big, const ToPositiveInf = 5
|
||||
pkg math/big, const ToPositiveInf RoundingMode
|
||||
pkg math/big, const ToZero = 2
|
||||
pkg math/big, const ToZero RoundingMode
|
||||
pkg math/big, func Jacobi(*Int, *Int) int
|
||||
pkg math/big, func NewFloat(float64) *Float
|
||||
pkg math/big, func ParseFloat(string, int, uint, RoundingMode) (*Float, int, error)
|
||||
pkg math/big, method (*Float) Abs(*Float) *Float
|
||||
pkg math/big, method (*Float) Acc() Accuracy
|
||||
pkg math/big, method (*Float) Add(*Float, *Float) *Float
|
||||
pkg math/big, method (*Float) Append([]uint8, uint8, int) []uint8
|
||||
pkg math/big, method (*Float) Cmp(*Float) int
|
||||
pkg math/big, method (*Float) Copy(*Float) *Float
|
||||
pkg math/big, method (*Float) Float32() (float32, Accuracy)
|
||||
pkg math/big, method (*Float) Float64() (float64, Accuracy)
|
||||
pkg math/big, method (*Float) Format(fmt.State, int32)
|
||||
pkg math/big, method (*Float) Int(*Int) (*Int, Accuracy)
|
||||
pkg math/big, method (*Float) Int64() (int64, Accuracy)
|
||||
pkg math/big, method (*Float) IsInf() bool
|
||||
pkg math/big, method (*Float) IsInt() bool
|
||||
pkg math/big, method (*Float) MantExp(*Float) int
|
||||
pkg math/big, method (*Float) MinPrec() uint
|
||||
pkg math/big, method (*Float) Mode() RoundingMode
|
||||
pkg math/big, method (*Float) Mul(*Float, *Float) *Float
|
||||
pkg math/big, method (*Float) Neg(*Float) *Float
|
||||
pkg math/big, method (*Float) Parse(string, int) (*Float, int, error)
|
||||
pkg math/big, method (*Float) Prec() uint
|
||||
pkg math/big, method (*Float) Quo(*Float, *Float) *Float
|
||||
pkg math/big, method (*Float) Rat(*Rat) (*Rat, Accuracy)
|
||||
pkg math/big, method (*Float) Set(*Float) *Float
|
||||
pkg math/big, method (*Float) SetFloat64(float64) *Float
|
||||
pkg math/big, method (*Float) SetInf(bool) *Float
|
||||
pkg math/big, method (*Float) SetInt(*Int) *Float
|
||||
pkg math/big, method (*Float) SetInt64(int64) *Float
|
||||
pkg math/big, method (*Float) SetMantExp(*Float, int) *Float
|
||||
pkg math/big, method (*Float) SetMode(RoundingMode) *Float
|
||||
pkg math/big, method (*Float) SetPrec(uint) *Float
|
||||
pkg math/big, method (*Float) SetRat(*Rat) *Float
|
||||
pkg math/big, method (*Float) SetString(string) (*Float, bool)
|
||||
pkg math/big, method (*Float) SetUint64(uint64) *Float
|
||||
pkg math/big, method (*Float) Sign() int
|
||||
pkg math/big, method (*Float) Signbit() bool
|
||||
pkg math/big, method (*Float) String() string
|
||||
pkg math/big, method (*Float) Sub(*Float, *Float) *Float
|
||||
pkg math/big, method (*Float) Text(uint8, int) string
|
||||
pkg math/big, method (*Float) Uint64() (uint64, Accuracy)
|
||||
pkg math/big, method (*Int) ModSqrt(*Int, *Int) *Int
|
||||
pkg math/big, method (Accuracy) String() string
|
||||
pkg math/big, method (ErrNaN) Error() string
|
||||
pkg math/big, method (RoundingMode) String() string
|
||||
pkg math/big, type Accuracy int8
|
||||
pkg math/big, type ErrNaN struct
|
||||
pkg math/big, type Float struct
|
||||
pkg math/big, type RoundingMode uint8
|
||||
pkg mime, const BEncoding = 98
|
||||
pkg mime, const BEncoding WordEncoder
|
||||
pkg mime, const QEncoding = 113
|
||||
pkg mime, const QEncoding WordEncoder
|
||||
pkg mime, func ExtensionsByType(string) ([]string, error)
|
||||
pkg mime, method (*WordDecoder) Decode(string) (string, error)
|
||||
pkg mime, method (*WordDecoder) DecodeHeader(string) (string, error)
|
||||
pkg mime, method (WordEncoder) Encode(string, string) string
|
||||
pkg mime, type WordDecoder struct
|
||||
pkg mime, type WordDecoder struct, CharsetReader func(string, io.Reader) (io.Reader, error)
|
||||
pkg mime, type WordEncoder uint8
|
||||
pkg mime/quotedprintable, func NewReader(io.Reader) *Reader
|
||||
pkg mime/quotedprintable, func NewWriter(io.Writer) *Writer
|
||||
pkg mime/quotedprintable, method (*Reader) Read([]uint8) (int, error)
|
||||
pkg mime/quotedprintable, method (*Writer) Close() error
|
||||
pkg mime/quotedprintable, method (*Writer) Write([]uint8) (int, error)
|
||||
pkg mime/quotedprintable, type Reader struct
|
||||
pkg mime/quotedprintable, type Writer struct
|
||||
pkg mime/quotedprintable, type Writer struct, Binary bool
|
||||
pkg net, type Dialer struct, FallbackDelay time.Duration
|
||||
pkg net, type OpError struct, Source Addr
|
||||
pkg net/http, type Request struct, Cancel <-chan struct
|
||||
pkg net/http/fcgi, var ErrConnClosed error
|
||||
pkg net/http/fcgi, var ErrRequestAborted error
|
||||
pkg net/http/pprof, func Trace(http.ResponseWriter, *http.Request)
|
||||
pkg net/mail, method (*AddressParser) Parse(string) (*Address, error)
|
||||
pkg net/mail, method (*AddressParser) ParseList(string) ([]*Address, error)
|
||||
pkg net/mail, type AddressParser struct
|
||||
pkg net/mail, type AddressParser struct, WordDecoder *mime.WordDecoder
|
||||
pkg net/smtp, method (*Client) TLSConnectionState() (tls.ConnectionState, bool)
|
||||
pkg net/url, method (*URL) EscapedPath() string
|
||||
pkg net/url, type URL struct, RawPath string
|
||||
pkg os, func LookupEnv(string) (string, bool)
|
||||
pkg os/signal, func Ignore(...os.Signal)
|
||||
pkg os/signal, func Reset(...os.Signal)
|
||||
pkg reflect, func ArrayOf(int, Type) Type
|
||||
pkg reflect, func FuncOf([]Type, []Type, bool) Type
|
||||
pkg runtime, func ReadTrace() []uint8
|
||||
pkg runtime, func StartTrace() error
|
||||
pkg runtime, func StopTrace()
|
||||
pkg runtime, type MemStats struct, GCCPUFraction float64
|
||||
pkg runtime/trace, func Start(io.Writer) error
|
||||
pkg runtime/trace, func Stop()
|
||||
pkg strings, func Compare(string, string) int
|
||||
pkg strings, func LastIndexByte(string, uint8) int
|
||||
pkg strings, method (*Reader) Size() int64
|
||||
pkg syscall (darwin-386), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (darwin-386), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (darwin-386), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (darwin-386-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (darwin-386-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (darwin-386-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (darwin-amd64), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (darwin-amd64), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (darwin-amd64), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (darwin-amd64-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (darwin-amd64-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (darwin-amd64-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (freebsd-386), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (freebsd-386), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (freebsd-386), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (freebsd-386-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (freebsd-386-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (freebsd-386-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (freebsd-amd64), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (freebsd-amd64), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (freebsd-amd64), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (freebsd-amd64-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (freebsd-amd64-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (freebsd-amd64-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (freebsd-arm), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (freebsd-arm), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (freebsd-arm), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (freebsd-arm-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (freebsd-arm-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (freebsd-arm-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (linux-386), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (linux-386), type SysProcAttr struct, GidMappingsEnableSetgroups bool
|
||||
pkg syscall (linux-386), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (linux-386-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (linux-386-cgo), type SysProcAttr struct, GidMappingsEnableSetgroups bool
|
||||
pkg syscall (linux-386-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (linux-amd64), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (linux-amd64), type SysProcAttr struct, GidMappingsEnableSetgroups bool
|
||||
pkg syscall (linux-amd64), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (linux-amd64-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (linux-amd64-cgo), type SysProcAttr struct, GidMappingsEnableSetgroups bool
|
||||
pkg syscall (linux-amd64-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (linux-arm), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (linux-arm), type SysProcAttr struct, GidMappingsEnableSetgroups bool
|
||||
pkg syscall (linux-arm), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (linux-arm-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (linux-arm-cgo), type SysProcAttr struct, GidMappingsEnableSetgroups bool
|
||||
pkg syscall (linux-arm-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (netbsd-386), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (netbsd-386), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (netbsd-386), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (netbsd-386-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (netbsd-386-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (netbsd-386-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (netbsd-amd64), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (netbsd-amd64), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (netbsd-amd64), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (netbsd-amd64-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (netbsd-amd64-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (netbsd-amd64-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (netbsd-arm), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (netbsd-arm), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (netbsd-arm), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (netbsd-arm-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (netbsd-arm-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (netbsd-arm-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (openbsd-386), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (openbsd-386), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (openbsd-386), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (openbsd-386-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (openbsd-386-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (openbsd-386-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (openbsd-amd64), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (openbsd-amd64), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (openbsd-amd64), type SysProcAttr struct, Pgid int
|
||||
pkg syscall (openbsd-amd64-cgo), type SysProcAttr struct, Ctty int
|
||||
pkg syscall (openbsd-amd64-cgo), type SysProcAttr struct, Foreground bool
|
||||
pkg syscall (openbsd-amd64-cgo), type SysProcAttr struct, Pgid int
|
||||
pkg text/template, method (*Template) DefinedTemplates() string
|
||||
pkg text/template, method (*Template) Option(...string) *Template
|
||||
pkg time, method (Time) AppendFormat([]uint8, string) []uint8
|
||||
pkg unicode, const Version = "8.0.0"
|
||||
pkg unicode, var Ahom *RangeTable
|
||||
pkg unicode, var Anatolian_Hieroglyphs *RangeTable
|
||||
pkg unicode, var Hatran *RangeTable
|
||||
pkg unicode, var Multani *RangeTable
|
||||
pkg unicode, var Old_Hungarian *RangeTable
|
||||
pkg unicode, var SignWriting *RangeTable
|
||||
275
api/go1.6.txt
275
api/go1.6.txt
@@ -1,275 +0,0 @@
|
||||
pkg archive/zip, method (*ReadCloser) RegisterDecompressor(uint16, Decompressor)
|
||||
pkg archive/zip, method (*Reader) RegisterDecompressor(uint16, Decompressor)
|
||||
pkg archive/zip, method (*Writer) RegisterCompressor(uint16, Compressor)
|
||||
pkg bufio, method (*Scanner) Buffer([]uint8, int)
|
||||
pkg bufio, var ErrFinalToken error
|
||||
pkg crypto/tls, const TLS_RSA_WITH_AES_128_GCM_SHA256 = 156
|
||||
pkg crypto/tls, const TLS_RSA_WITH_AES_128_GCM_SHA256 uint16
|
||||
pkg crypto/tls, const TLS_RSA_WITH_AES_256_GCM_SHA384 = 157
|
||||
pkg crypto/tls, const TLS_RSA_WITH_AES_256_GCM_SHA384 uint16
|
||||
pkg crypto/tls, method (RecordHeaderError) Error() string
|
||||
pkg crypto/tls, type RecordHeaderError struct
|
||||
pkg crypto/tls, type RecordHeaderError struct, Msg string
|
||||
pkg crypto/tls, type RecordHeaderError struct, RecordHeader [5]uint8
|
||||
pkg crypto/x509, method (InsecureAlgorithmError) Error() string
|
||||
pkg crypto/x509, method (SignatureAlgorithm) String() string
|
||||
pkg crypto/x509, type InsecureAlgorithmError int
|
||||
pkg database/sql, method (*DB) SetConnMaxLifetime(time.Duration)
|
||||
pkg debug/dwarf, const ClassUnknown = 0
|
||||
pkg debug/dwarf, const ClassUnknown Class
|
||||
pkg debug/elf, const COMPRESS_HIOS = 1879048191
|
||||
pkg debug/elf, const COMPRESS_HIOS CompressionType
|
||||
pkg debug/elf, const COMPRESS_HIPROC = 2147483647
|
||||
pkg debug/elf, const COMPRESS_HIPROC CompressionType
|
||||
pkg debug/elf, const COMPRESS_LOOS = 1610612736
|
||||
pkg debug/elf, const COMPRESS_LOOS CompressionType
|
||||
pkg debug/elf, const COMPRESS_LOPROC = 1879048192
|
||||
pkg debug/elf, const COMPRESS_LOPROC CompressionType
|
||||
pkg debug/elf, const COMPRESS_ZLIB = 1
|
||||
pkg debug/elf, const COMPRESS_ZLIB CompressionType
|
||||
pkg debug/elf, const R_MIPS_16 = 1
|
||||
pkg debug/elf, const R_MIPS_16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_26 = 4
|
||||
pkg debug/elf, const R_MIPS_26 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_32 = 2
|
||||
pkg debug/elf, const R_MIPS_32 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_64 = 18
|
||||
pkg debug/elf, const R_MIPS_64 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_ADD_IMMEDIATE = 34
|
||||
pkg debug/elf, const R_MIPS_ADD_IMMEDIATE R_MIPS
|
||||
pkg debug/elf, const R_MIPS_CALL16 = 11
|
||||
pkg debug/elf, const R_MIPS_CALL16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_CALL_HI16 = 30
|
||||
pkg debug/elf, const R_MIPS_CALL_HI16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_CALL_LO16 = 31
|
||||
pkg debug/elf, const R_MIPS_CALL_LO16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_DELETE = 27
|
||||
pkg debug/elf, const R_MIPS_DELETE R_MIPS
|
||||
pkg debug/elf, const R_MIPS_GOT16 = 9
|
||||
pkg debug/elf, const R_MIPS_GOT16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_GOT_DISP = 19
|
||||
pkg debug/elf, const R_MIPS_GOT_DISP R_MIPS
|
||||
pkg debug/elf, const R_MIPS_GOT_HI16 = 22
|
||||
pkg debug/elf, const R_MIPS_GOT_HI16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_GOT_LO16 = 23
|
||||
pkg debug/elf, const R_MIPS_GOT_LO16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_GOT_OFST = 21
|
||||
pkg debug/elf, const R_MIPS_GOT_OFST R_MIPS
|
||||
pkg debug/elf, const R_MIPS_GOT_PAGE = 20
|
||||
pkg debug/elf, const R_MIPS_GOT_PAGE R_MIPS
|
||||
pkg debug/elf, const R_MIPS_GPREL16 = 7
|
||||
pkg debug/elf, const R_MIPS_GPREL16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_GPREL32 = 12
|
||||
pkg debug/elf, const R_MIPS_GPREL32 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_HI16 = 5
|
||||
pkg debug/elf, const R_MIPS_HI16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_HIGHER = 28
|
||||
pkg debug/elf, const R_MIPS_HIGHER R_MIPS
|
||||
pkg debug/elf, const R_MIPS_HIGHEST = 29
|
||||
pkg debug/elf, const R_MIPS_HIGHEST R_MIPS
|
||||
pkg debug/elf, const R_MIPS_INSERT_A = 25
|
||||
pkg debug/elf, const R_MIPS_INSERT_A R_MIPS
|
||||
pkg debug/elf, const R_MIPS_INSERT_B = 26
|
||||
pkg debug/elf, const R_MIPS_INSERT_B R_MIPS
|
||||
pkg debug/elf, const R_MIPS_JALR = 37
|
||||
pkg debug/elf, const R_MIPS_JALR R_MIPS
|
||||
pkg debug/elf, const R_MIPS_LITERAL = 8
|
||||
pkg debug/elf, const R_MIPS_LITERAL R_MIPS
|
||||
pkg debug/elf, const R_MIPS_LO16 = 6
|
||||
pkg debug/elf, const R_MIPS_LO16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_NONE = 0
|
||||
pkg debug/elf, const R_MIPS_NONE R_MIPS
|
||||
pkg debug/elf, const R_MIPS_PC16 = 10
|
||||
pkg debug/elf, const R_MIPS_PC16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_PJUMP = 35
|
||||
pkg debug/elf, const R_MIPS_PJUMP R_MIPS
|
||||
pkg debug/elf, const R_MIPS_REL16 = 33
|
||||
pkg debug/elf, const R_MIPS_REL16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_REL32 = 3
|
||||
pkg debug/elf, const R_MIPS_REL32 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_RELGOT = 36
|
||||
pkg debug/elf, const R_MIPS_RELGOT R_MIPS
|
||||
pkg debug/elf, const R_MIPS_SCN_DISP = 32
|
||||
pkg debug/elf, const R_MIPS_SCN_DISP R_MIPS
|
||||
pkg debug/elf, const R_MIPS_SHIFT5 = 16
|
||||
pkg debug/elf, const R_MIPS_SHIFT5 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_SHIFT6 = 17
|
||||
pkg debug/elf, const R_MIPS_SHIFT6 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_SUB = 24
|
||||
pkg debug/elf, const R_MIPS_SUB R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPMOD32 = 38
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPMOD32 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPMOD64 = 40
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPMOD64 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPREL32 = 39
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPREL32 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPREL64 = 41
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPREL64 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPREL_HI16 = 44
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPREL_HI16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPREL_LO16 = 45
|
||||
pkg debug/elf, const R_MIPS_TLS_DTPREL_LO16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_GD = 42
|
||||
pkg debug/elf, const R_MIPS_TLS_GD R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_GOTTPREL = 46
|
||||
pkg debug/elf, const R_MIPS_TLS_GOTTPREL R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_LDM = 43
|
||||
pkg debug/elf, const R_MIPS_TLS_LDM R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_TPREL32 = 47
|
||||
pkg debug/elf, const R_MIPS_TLS_TPREL32 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_TPREL64 = 48
|
||||
pkg debug/elf, const R_MIPS_TLS_TPREL64 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_TPREL_HI16 = 49
|
||||
pkg debug/elf, const R_MIPS_TLS_TPREL_HI16 R_MIPS
|
||||
pkg debug/elf, const R_MIPS_TLS_TPREL_LO16 = 50
|
||||
pkg debug/elf, const R_MIPS_TLS_TPREL_LO16 R_MIPS
|
||||
pkg debug/elf, const SHF_COMPRESSED = 2048
|
||||
pkg debug/elf, const SHF_COMPRESSED SectionFlag
|
||||
pkg debug/elf, method (CompressionType) GoString() string
|
||||
pkg debug/elf, method (CompressionType) String() string
|
||||
pkg debug/elf, method (R_MIPS) GoString() string
|
||||
pkg debug/elf, method (R_MIPS) String() string
|
||||
pkg debug/elf, type Chdr32 struct
|
||||
pkg debug/elf, type Chdr32 struct, Addralign uint32
|
||||
pkg debug/elf, type Chdr32 struct, Size uint32
|
||||
pkg debug/elf, type Chdr32 struct, Type uint32
|
||||
pkg debug/elf, type Chdr64 struct
|
||||
pkg debug/elf, type Chdr64 struct, Addralign uint64
|
||||
pkg debug/elf, type Chdr64 struct, Size uint64
|
||||
pkg debug/elf, type Chdr64 struct, Type uint32
|
||||
pkg debug/elf, type CompressionType int
|
||||
pkg debug/elf, type R_MIPS int
|
||||
pkg debug/elf, type SectionHeader struct, FileSize uint64
|
||||
pkg encoding/asn1, const ClassApplication = 1
|
||||
pkg encoding/asn1, const ClassApplication ideal-int
|
||||
pkg encoding/asn1, const ClassContextSpecific = 2
|
||||
pkg encoding/asn1, const ClassContextSpecific ideal-int
|
||||
pkg encoding/asn1, const ClassPrivate = 3
|
||||
pkg encoding/asn1, const ClassPrivate ideal-int
|
||||
pkg encoding/asn1, const ClassUniversal = 0
|
||||
pkg encoding/asn1, const ClassUniversal ideal-int
|
||||
pkg encoding/asn1, const TagBitString = 3
|
||||
pkg encoding/asn1, const TagBitString ideal-int
|
||||
pkg encoding/asn1, const TagBoolean = 1
|
||||
pkg encoding/asn1, const TagBoolean ideal-int
|
||||
pkg encoding/asn1, const TagEnum = 10
|
||||
pkg encoding/asn1, const TagEnum ideal-int
|
||||
pkg encoding/asn1, const TagGeneralString = 27
|
||||
pkg encoding/asn1, const TagGeneralString ideal-int
|
||||
pkg encoding/asn1, const TagGeneralizedTime = 24
|
||||
pkg encoding/asn1, const TagGeneralizedTime ideal-int
|
||||
pkg encoding/asn1, const TagIA5String = 22
|
||||
pkg encoding/asn1, const TagIA5String ideal-int
|
||||
pkg encoding/asn1, const TagInteger = 2
|
||||
pkg encoding/asn1, const TagInteger ideal-int
|
||||
pkg encoding/asn1, const TagOID = 6
|
||||
pkg encoding/asn1, const TagOID ideal-int
|
||||
pkg encoding/asn1, const TagOctetString = 4
|
||||
pkg encoding/asn1, const TagOctetString ideal-int
|
||||
pkg encoding/asn1, const TagPrintableString = 19
|
||||
pkg encoding/asn1, const TagPrintableString ideal-int
|
||||
pkg encoding/asn1, const TagSequence = 16
|
||||
pkg encoding/asn1, const TagSequence ideal-int
|
||||
pkg encoding/asn1, const TagSet = 17
|
||||
pkg encoding/asn1, const TagSet ideal-int
|
||||
pkg encoding/asn1, const TagT61String = 20
|
||||
pkg encoding/asn1, const TagT61String ideal-int
|
||||
pkg encoding/asn1, const TagUTCTime = 23
|
||||
pkg encoding/asn1, const TagUTCTime ideal-int
|
||||
pkg encoding/asn1, const TagUTF8String = 12
|
||||
pkg encoding/asn1, const TagUTF8String ideal-int
|
||||
pkg go/build, const IgnoreVendor = 8
|
||||
pkg go/build, const IgnoreVendor ImportMode
|
||||
pkg go/build, type Package struct, InvalidGoFiles []string
|
||||
pkg go/constant, func ToComplex(Value) Value
|
||||
pkg go/constant, func ToFloat(Value) Value
|
||||
pkg go/constant, func ToInt(Value) Value
|
||||
pkg go/constant, type Value interface, ExactString() string
|
||||
pkg go/types, method (*Package) SetName(string)
|
||||
pkg go/types, type ImportMode int
|
||||
pkg go/types, type ImporterFrom interface { Import, ImportFrom }
|
||||
pkg go/types, type ImporterFrom interface, Import(string) (*Package, error)
|
||||
pkg go/types, type ImporterFrom interface, ImportFrom(string, string, ImportMode) (*Package, error)
|
||||
pkg html/template, func IsTrue(interface{}) (bool, bool)
|
||||
pkg html/template, method (*Template) DefinedTemplates() string
|
||||
pkg image, func NewNYCbCrA(Rectangle, YCbCrSubsampleRatio) *NYCbCrA
|
||||
pkg image, method (*NYCbCrA) AOffset(int, int) int
|
||||
pkg image, method (*NYCbCrA) At(int, int) color.Color
|
||||
pkg image, method (*NYCbCrA) Bounds() Rectangle
|
||||
pkg image, method (*NYCbCrA) COffset(int, int) int
|
||||
pkg image, method (*NYCbCrA) ColorModel() color.Model
|
||||
pkg image, method (*NYCbCrA) NYCbCrAAt(int, int) color.NYCbCrA
|
||||
pkg image, method (*NYCbCrA) Opaque() bool
|
||||
pkg image, method (*NYCbCrA) SubImage(Rectangle) Image
|
||||
pkg image, method (*NYCbCrA) YCbCrAt(int, int) color.YCbCr
|
||||
pkg image, method (*NYCbCrA) YOffset(int, int) int
|
||||
pkg image, type NYCbCrA struct
|
||||
pkg image, type NYCbCrA struct, A []uint8
|
||||
pkg image, type NYCbCrA struct, AStride int
|
||||
pkg image, type NYCbCrA struct, embedded YCbCr
|
||||
pkg image/color, method (NYCbCrA) RGBA() (uint32, uint32, uint32, uint32)
|
||||
pkg image/color, type NYCbCrA struct
|
||||
pkg image/color, type NYCbCrA struct, A uint8
|
||||
pkg image/color, type NYCbCrA struct, embedded YCbCr
|
||||
pkg image/color, var NYCbCrAModel Model
|
||||
pkg math/big, method (*Float) MarshalText() ([]uint8, error)
|
||||
pkg math/big, method (*Float) UnmarshalText([]uint8) error
|
||||
pkg math/big, method (*Int) Append([]uint8, int) []uint8
|
||||
pkg math/big, method (*Int) Text(int) string
|
||||
pkg math/rand, func Read([]uint8) (int, error)
|
||||
pkg math/rand, method (*Rand) Read([]uint8) (int, error)
|
||||
pkg net, type DNSError struct, IsTemporary bool
|
||||
pkg net, type Dialer struct, Cancel <-chan struct
|
||||
pkg net/http, const MethodConnect = "CONNECT"
|
||||
pkg net/http, const MethodConnect ideal-string
|
||||
pkg net/http, const MethodDelete = "DELETE"
|
||||
pkg net/http, const MethodDelete ideal-string
|
||||
pkg net/http, const MethodGet = "GET"
|
||||
pkg net/http, const MethodGet ideal-string
|
||||
pkg net/http, const MethodHead = "HEAD"
|
||||
pkg net/http, const MethodHead ideal-string
|
||||
pkg net/http, const MethodOptions = "OPTIONS"
|
||||
pkg net/http, const MethodOptions ideal-string
|
||||
pkg net/http, const MethodPatch = "PATCH"
|
||||
pkg net/http, const MethodPatch ideal-string
|
||||
pkg net/http, const MethodPost = "POST"
|
||||
pkg net/http, const MethodPost ideal-string
|
||||
pkg net/http, const MethodPut = "PUT"
|
||||
pkg net/http, const MethodPut ideal-string
|
||||
pkg net/http, const MethodTrace = "TRACE"
|
||||
pkg net/http, const MethodTrace ideal-string
|
||||
pkg net/http, const StatusNetworkAuthenticationRequired = 511
|
||||
pkg net/http, const StatusNetworkAuthenticationRequired ideal-int
|
||||
pkg net/http, const StatusPreconditionRequired = 428
|
||||
pkg net/http, const StatusPreconditionRequired ideal-int
|
||||
pkg net/http, const StatusRequestHeaderFieldsTooLarge = 431
|
||||
pkg net/http, const StatusRequestHeaderFieldsTooLarge ideal-int
|
||||
pkg net/http, const StatusTooManyRequests = 429
|
||||
pkg net/http, const StatusTooManyRequests ideal-int
|
||||
pkg net/http, const StatusUnavailableForLegalReasons = 451
|
||||
pkg net/http, const StatusUnavailableForLegalReasons ideal-int
|
||||
pkg net/http, type Transport struct, ExpectContinueTimeout time.Duration
|
||||
pkg net/http, type Transport struct, TLSNextProto map[string]func(string, *tls.Conn) RoundTripper
|
||||
pkg net/http, var ErrSkipAltProtocol error
|
||||
pkg net/http/httptest, method (*ResponseRecorder) WriteString(string) (int, error)
|
||||
pkg net/http/httputil, type BufferPool interface { Get, Put }
|
||||
pkg net/http/httputil, type BufferPool interface, Get() []uint8
|
||||
pkg net/http/httputil, type BufferPool interface, Put([]uint8)
|
||||
pkg net/http/httputil, type ReverseProxy struct, BufferPool BufferPool
|
||||
pkg net/url, method (*Error) Temporary() bool
|
||||
pkg net/url, method (*Error) Timeout() bool
|
||||
pkg net/url, method (InvalidHostError) Error() string
|
||||
pkg net/url, type InvalidHostError string
|
||||
pkg os/exec, type ExitError struct, Stderr []uint8
|
||||
pkg regexp, method (*Regexp) Copy() *Regexp
|
||||
pkg runtime/debug, func SetTraceback(string)
|
||||
pkg strconv, func AppendQuoteRuneToGraphic([]uint8, int32) []uint8
|
||||
pkg strconv, func AppendQuoteToGraphic([]uint8, string) []uint8
|
||||
pkg strconv, func IsGraphic(int32) bool
|
||||
pkg strconv, func QuoteRuneToGraphic(int32) string
|
||||
pkg strconv, func QuoteToGraphic(string) string
|
||||
pkg text/template, func IsTrue(interface{}) (bool, bool)
|
||||
pkg text/template, method (ExecError) Error() string
|
||||
pkg text/template, type ExecError struct
|
||||
pkg text/template, type ExecError struct, Err error
|
||||
pkg text/template, type ExecError struct, Name string
|
||||
285
api/go1.7.txt
285
api/go1.7.txt
@@ -1,285 +0,0 @@
|
||||
pkg bytes, func ContainsAny([]uint8, string) bool
|
||||
pkg bytes, func ContainsRune([]uint8, int32) bool
|
||||
pkg bytes, method (*Reader) Reset([]uint8)
|
||||
pkg compress/flate, const HuffmanOnly = -2
|
||||
pkg compress/flate, const HuffmanOnly ideal-int
|
||||
pkg context, func Background() Context
|
||||
pkg context, func TODO() Context
|
||||
pkg context, func WithCancel(Context) (Context, CancelFunc)
|
||||
pkg context, func WithDeadline(Context, time.Time) (Context, CancelFunc)
|
||||
pkg context, func WithTimeout(Context, time.Duration) (Context, CancelFunc)
|
||||
pkg context, func WithValue(Context, interface{}, interface{}) Context
|
||||
pkg context, type CancelFunc func()
|
||||
pkg context, type Context interface { Deadline, Done, Err, Value }
|
||||
pkg context, type Context interface, Deadline() (time.Time, bool)
|
||||
pkg context, type Context interface, Done() <-chan struct
|
||||
pkg context, type Context interface, Err() error
|
||||
pkg context, type Context interface, Value(interface{}) interface{}
|
||||
pkg context, var Canceled error
|
||||
pkg context, var DeadlineExceeded error
|
||||
pkg crypto/tls, const RenegotiateFreelyAsClient = 2
|
||||
pkg crypto/tls, const RenegotiateFreelyAsClient RenegotiationSupport
|
||||
pkg crypto/tls, const RenegotiateNever = 0
|
||||
pkg crypto/tls, const RenegotiateNever RenegotiationSupport
|
||||
pkg crypto/tls, const RenegotiateOnceAsClient = 1
|
||||
pkg crypto/tls, const RenegotiateOnceAsClient RenegotiationSupport
|
||||
pkg crypto/tls, type Config struct, DynamicRecordSizingDisabled bool
|
||||
pkg crypto/tls, type Config struct, Renegotiation RenegotiationSupport
|
||||
pkg crypto/tls, type RenegotiationSupport int
|
||||
pkg crypto/x509, func SystemCertPool() (*CertPool, error)
|
||||
pkg crypto/x509, type SystemRootsError struct, Err error
|
||||
pkg debug/dwarf, method (*Data) Ranges(*Entry) ([][2]uint64, error)
|
||||
pkg debug/dwarf, method (*Reader) SeekPC(uint64) (*Entry, error)
|
||||
pkg debug/elf, const R_390_12 = 2
|
||||
pkg debug/elf, const R_390_12 R_390
|
||||
pkg debug/elf, const R_390_16 = 3
|
||||
pkg debug/elf, const R_390_16 R_390
|
||||
pkg debug/elf, const R_390_20 = 57
|
||||
pkg debug/elf, const R_390_20 R_390
|
||||
pkg debug/elf, const R_390_32 = 4
|
||||
pkg debug/elf, const R_390_32 R_390
|
||||
pkg debug/elf, const R_390_64 = 22
|
||||
pkg debug/elf, const R_390_64 R_390
|
||||
pkg debug/elf, const R_390_8 = 1
|
||||
pkg debug/elf, const R_390_8 R_390
|
||||
pkg debug/elf, const R_390_COPY = 9
|
||||
pkg debug/elf, const R_390_COPY R_390
|
||||
pkg debug/elf, const R_390_GLOB_DAT = 10
|
||||
pkg debug/elf, const R_390_GLOB_DAT R_390
|
||||
pkg debug/elf, const R_390_GOT12 = 6
|
||||
pkg debug/elf, const R_390_GOT12 R_390
|
||||
pkg debug/elf, const R_390_GOT16 = 15
|
||||
pkg debug/elf, const R_390_GOT16 R_390
|
||||
pkg debug/elf, const R_390_GOT20 = 58
|
||||
pkg debug/elf, const R_390_GOT20 R_390
|
||||
pkg debug/elf, const R_390_GOT32 = 7
|
||||
pkg debug/elf, const R_390_GOT32 R_390
|
||||
pkg debug/elf, const R_390_GOT64 = 24
|
||||
pkg debug/elf, const R_390_GOT64 R_390
|
||||
pkg debug/elf, const R_390_GOTENT = 26
|
||||
pkg debug/elf, const R_390_GOTENT R_390
|
||||
pkg debug/elf, const R_390_GOTOFF = 13
|
||||
pkg debug/elf, const R_390_GOTOFF R_390
|
||||
pkg debug/elf, const R_390_GOTOFF16 = 27
|
||||
pkg debug/elf, const R_390_GOTOFF16 R_390
|
||||
pkg debug/elf, const R_390_GOTOFF64 = 28
|
||||
pkg debug/elf, const R_390_GOTOFF64 R_390
|
||||
pkg debug/elf, const R_390_GOTPC = 14
|
||||
pkg debug/elf, const R_390_GOTPC R_390
|
||||
pkg debug/elf, const R_390_GOTPCDBL = 21
|
||||
pkg debug/elf, const R_390_GOTPCDBL R_390
|
||||
pkg debug/elf, const R_390_GOTPLT12 = 29
|
||||
pkg debug/elf, const R_390_GOTPLT12 R_390
|
||||
pkg debug/elf, const R_390_GOTPLT16 = 30
|
||||
pkg debug/elf, const R_390_GOTPLT16 R_390
|
||||
pkg debug/elf, const R_390_GOTPLT20 = 59
|
||||
pkg debug/elf, const R_390_GOTPLT20 R_390
|
||||
pkg debug/elf, const R_390_GOTPLT32 = 31
|
||||
pkg debug/elf, const R_390_GOTPLT32 R_390
|
||||
pkg debug/elf, const R_390_GOTPLT64 = 32
|
||||
pkg debug/elf, const R_390_GOTPLT64 R_390
|
||||
pkg debug/elf, const R_390_GOTPLTENT = 33
|
||||
pkg debug/elf, const R_390_GOTPLTENT R_390
|
||||
pkg debug/elf, const R_390_GOTPLTOFF16 = 34
|
||||
pkg debug/elf, const R_390_GOTPLTOFF16 R_390
|
||||
pkg debug/elf, const R_390_GOTPLTOFF32 = 35
|
||||
pkg debug/elf, const R_390_GOTPLTOFF32 R_390
|
||||
pkg debug/elf, const R_390_GOTPLTOFF64 = 36
|
||||
pkg debug/elf, const R_390_GOTPLTOFF64 R_390
|
||||
pkg debug/elf, const R_390_JMP_SLOT = 11
|
||||
pkg debug/elf, const R_390_JMP_SLOT R_390
|
||||
pkg debug/elf, const R_390_NONE = 0
|
||||
pkg debug/elf, const R_390_NONE R_390
|
||||
pkg debug/elf, const R_390_PC16 = 16
|
||||
pkg debug/elf, const R_390_PC16 R_390
|
||||
pkg debug/elf, const R_390_PC16DBL = 17
|
||||
pkg debug/elf, const R_390_PC16DBL R_390
|
||||
pkg debug/elf, const R_390_PC32 = 5
|
||||
pkg debug/elf, const R_390_PC32 R_390
|
||||
pkg debug/elf, const R_390_PC32DBL = 19
|
||||
pkg debug/elf, const R_390_PC32DBL R_390
|
||||
pkg debug/elf, const R_390_PC64 = 23
|
||||
pkg debug/elf, const R_390_PC64 R_390
|
||||
pkg debug/elf, const R_390_PLT16DBL = 18
|
||||
pkg debug/elf, const R_390_PLT16DBL R_390
|
||||
pkg debug/elf, const R_390_PLT32 = 8
|
||||
pkg debug/elf, const R_390_PLT32 R_390
|
||||
pkg debug/elf, const R_390_PLT32DBL = 20
|
||||
pkg debug/elf, const R_390_PLT32DBL R_390
|
||||
pkg debug/elf, const R_390_PLT64 = 25
|
||||
pkg debug/elf, const R_390_PLT64 R_390
|
||||
pkg debug/elf, const R_390_RELATIVE = 12
|
||||
pkg debug/elf, const R_390_RELATIVE R_390
|
||||
pkg debug/elf, const R_390_TLS_DTPMOD = 54
|
||||
pkg debug/elf, const R_390_TLS_DTPMOD R_390
|
||||
pkg debug/elf, const R_390_TLS_DTPOFF = 55
|
||||
pkg debug/elf, const R_390_TLS_DTPOFF R_390
|
||||
pkg debug/elf, const R_390_TLS_GD32 = 40
|
||||
pkg debug/elf, const R_390_TLS_GD32 R_390
|
||||
pkg debug/elf, const R_390_TLS_GD64 = 41
|
||||
pkg debug/elf, const R_390_TLS_GD64 R_390
|
||||
pkg debug/elf, const R_390_TLS_GDCALL = 38
|
||||
pkg debug/elf, const R_390_TLS_GDCALL R_390
|
||||
pkg debug/elf, const R_390_TLS_GOTIE12 = 42
|
||||
pkg debug/elf, const R_390_TLS_GOTIE12 R_390
|
||||
pkg debug/elf, const R_390_TLS_GOTIE20 = 60
|
||||
pkg debug/elf, const R_390_TLS_GOTIE20 R_390
|
||||
pkg debug/elf, const R_390_TLS_GOTIE32 = 43
|
||||
pkg debug/elf, const R_390_TLS_GOTIE32 R_390
|
||||
pkg debug/elf, const R_390_TLS_GOTIE64 = 44
|
||||
pkg debug/elf, const R_390_TLS_GOTIE64 R_390
|
||||
pkg debug/elf, const R_390_TLS_IE32 = 47
|
||||
pkg debug/elf, const R_390_TLS_IE32 R_390
|
||||
pkg debug/elf, const R_390_TLS_IE64 = 48
|
||||
pkg debug/elf, const R_390_TLS_IE64 R_390
|
||||
pkg debug/elf, const R_390_TLS_IEENT = 49
|
||||
pkg debug/elf, const R_390_TLS_IEENT R_390
|
||||
pkg debug/elf, const R_390_TLS_LDCALL = 39
|
||||
pkg debug/elf, const R_390_TLS_LDCALL R_390
|
||||
pkg debug/elf, const R_390_TLS_LDM32 = 45
|
||||
pkg debug/elf, const R_390_TLS_LDM32 R_390
|
||||
pkg debug/elf, const R_390_TLS_LDM64 = 46
|
||||
pkg debug/elf, const R_390_TLS_LDM64 R_390
|
||||
pkg debug/elf, const R_390_TLS_LDO32 = 52
|
||||
pkg debug/elf, const R_390_TLS_LDO32 R_390
|
||||
pkg debug/elf, const R_390_TLS_LDO64 = 53
|
||||
pkg debug/elf, const R_390_TLS_LDO64 R_390
|
||||
pkg debug/elf, const R_390_TLS_LE32 = 50
|
||||
pkg debug/elf, const R_390_TLS_LE32 R_390
|
||||
pkg debug/elf, const R_390_TLS_LE64 = 51
|
||||
pkg debug/elf, const R_390_TLS_LE64 R_390
|
||||
pkg debug/elf, const R_390_TLS_LOAD = 37
|
||||
pkg debug/elf, const R_390_TLS_LOAD R_390
|
||||
pkg debug/elf, const R_390_TLS_TPOFF = 56
|
||||
pkg debug/elf, const R_390_TLS_TPOFF R_390
|
||||
pkg debug/elf, method (R_390) GoString() string
|
||||
pkg debug/elf, method (R_390) String() string
|
||||
pkg debug/elf, type R_390 int
|
||||
pkg encoding/json, method (*Encoder) SetEscapeHTML(bool)
|
||||
pkg encoding/json, method (*Encoder) SetIndent(string, string)
|
||||
pkg go/build, type Package struct, BinaryOnly bool
|
||||
pkg go/build, type Package struct, CgoFFLAGS []string
|
||||
pkg go/build, type Package struct, FFiles []string
|
||||
pkg go/doc, type Example struct, Unordered bool
|
||||
pkg io, const SeekCurrent = 1
|
||||
pkg io, const SeekCurrent ideal-int
|
||||
pkg io, const SeekEnd = 2
|
||||
pkg io, const SeekEnd ideal-int
|
||||
pkg io, const SeekStart = 0
|
||||
pkg io, const SeekStart ideal-int
|
||||
pkg math/big, method (*Float) GobDecode([]uint8) error
|
||||
pkg math/big, method (*Float) GobEncode() ([]uint8, error)
|
||||
pkg net, method (*Dialer) DialContext(context.Context, string, string) (Conn, error)
|
||||
pkg net/http, const StatusAlreadyReported = 208
|
||||
pkg net/http, const StatusAlreadyReported ideal-int
|
||||
pkg net/http, const StatusFailedDependency = 424
|
||||
pkg net/http, const StatusFailedDependency ideal-int
|
||||
pkg net/http, const StatusIMUsed = 226
|
||||
pkg net/http, const StatusIMUsed ideal-int
|
||||
pkg net/http, const StatusInsufficientStorage = 507
|
||||
pkg net/http, const StatusInsufficientStorage ideal-int
|
||||
pkg net/http, const StatusLocked = 423
|
||||
pkg net/http, const StatusLocked ideal-int
|
||||
pkg net/http, const StatusLoopDetected = 508
|
||||
pkg net/http, const StatusLoopDetected ideal-int
|
||||
pkg net/http, const StatusMultiStatus = 207
|
||||
pkg net/http, const StatusMultiStatus ideal-int
|
||||
pkg net/http, const StatusNotExtended = 510
|
||||
pkg net/http, const StatusNotExtended ideal-int
|
||||
pkg net/http, const StatusPermanentRedirect = 308
|
||||
pkg net/http, const StatusPermanentRedirect ideal-int
|
||||
pkg net/http, const StatusProcessing = 102
|
||||
pkg net/http, const StatusProcessing ideal-int
|
||||
pkg net/http, const StatusUnprocessableEntity = 422
|
||||
pkg net/http, const StatusUnprocessableEntity ideal-int
|
||||
pkg net/http, const StatusUpgradeRequired = 426
|
||||
pkg net/http, const StatusUpgradeRequired ideal-int
|
||||
pkg net/http, const StatusVariantAlsoNegotiates = 506
|
||||
pkg net/http, const StatusVariantAlsoNegotiates ideal-int
|
||||
pkg net/http, method (*Request) Context() context.Context
|
||||
pkg net/http, method (*Request) WithContext(context.Context) *Request
|
||||
pkg net/http, type Request struct, Response *Response
|
||||
pkg net/http, type Response struct, Uncompressed bool
|
||||
pkg net/http, type Transport struct, DialContext func(context.Context, string, string) (net.Conn, error)
|
||||
pkg net/http, type Transport struct, IdleConnTimeout time.Duration
|
||||
pkg net/http, type Transport struct, MaxIdleConns int
|
||||
pkg net/http, type Transport struct, MaxResponseHeaderBytes int64
|
||||
pkg net/http, var ErrUseLastResponse error
|
||||
pkg net/http, var LocalAddrContextKey *contextKey
|
||||
pkg net/http, var ServerContextKey *contextKey
|
||||
pkg net/http/cgi, type Handler struct, Stderr io.Writer
|
||||
pkg net/http/httptest, func NewRequest(string, string, io.Reader) *http.Request
|
||||
pkg net/http/httptest, method (*ResponseRecorder) Result() *http.Response
|
||||
pkg net/http/httptrace, func ContextClientTrace(context.Context) *ClientTrace
|
||||
pkg net/http/httptrace, func WithClientTrace(context.Context, *ClientTrace) context.Context
|
||||
pkg net/http/httptrace, type ClientTrace struct
|
||||
pkg net/http/httptrace, type ClientTrace struct, ConnectDone func(string, string, error)
|
||||
pkg net/http/httptrace, type ClientTrace struct, ConnectStart func(string, string)
|
||||
pkg net/http/httptrace, type ClientTrace struct, DNSDone func(DNSDoneInfo)
|
||||
pkg net/http/httptrace, type ClientTrace struct, DNSStart func(DNSStartInfo)
|
||||
pkg net/http/httptrace, type ClientTrace struct, GetConn func(string)
|
||||
pkg net/http/httptrace, type ClientTrace struct, Got100Continue func()
|
||||
pkg net/http/httptrace, type ClientTrace struct, GotConn func(GotConnInfo)
|
||||
pkg net/http/httptrace, type ClientTrace struct, GotFirstResponseByte func()
|
||||
pkg net/http/httptrace, type ClientTrace struct, PutIdleConn func(error)
|
||||
pkg net/http/httptrace, type ClientTrace struct, Wait100Continue func()
|
||||
pkg net/http/httptrace, type ClientTrace struct, WroteHeaders func()
|
||||
pkg net/http/httptrace, type ClientTrace struct, WroteRequest func(WroteRequestInfo)
|
||||
pkg net/http/httptrace, type DNSDoneInfo struct
|
||||
pkg net/http/httptrace, type DNSDoneInfo struct, Addrs []net.IPAddr
|
||||
pkg net/http/httptrace, type DNSDoneInfo struct, Coalesced bool
|
||||
pkg net/http/httptrace, type DNSDoneInfo struct, Err error
|
||||
pkg net/http/httptrace, type DNSStartInfo struct
|
||||
pkg net/http/httptrace, type DNSStartInfo struct, Host string
|
||||
pkg net/http/httptrace, type GotConnInfo struct
|
||||
pkg net/http/httptrace, type GotConnInfo struct, Conn net.Conn
|
||||
pkg net/http/httptrace, type GotConnInfo struct, IdleTime time.Duration
|
||||
pkg net/http/httptrace, type GotConnInfo struct, Reused bool
|
||||
pkg net/http/httptrace, type GotConnInfo struct, WasIdle bool
|
||||
pkg net/http/httptrace, type WroteRequestInfo struct
|
||||
pkg net/http/httptrace, type WroteRequestInfo struct, Err error
|
||||
pkg net/url, type URL struct, ForceQuery bool
|
||||
pkg os/exec, func CommandContext(context.Context, string, ...string) *Cmd
|
||||
pkg os/user, func LookupGroup(string) (*Group, error)
|
||||
pkg os/user, func LookupGroupId(string) (*Group, error)
|
||||
pkg os/user, method (*User) GroupIds() ([]string, error)
|
||||
pkg os/user, method (UnknownGroupError) Error() string
|
||||
pkg os/user, method (UnknownGroupIdError) Error() string
|
||||
pkg os/user, type Group struct
|
||||
pkg os/user, type Group struct, Gid string
|
||||
pkg os/user, type Group struct, Name string
|
||||
pkg os/user, type UnknownGroupError string
|
||||
pkg os/user, type UnknownGroupIdError string
|
||||
pkg reflect, func StructOf([]StructField) Type
|
||||
pkg reflect, method (StructTag) Lookup(string) (string, bool)
|
||||
pkg runtime, func CallersFrames([]uintptr) *Frames
|
||||
pkg runtime, func KeepAlive(interface{})
|
||||
pkg runtime, func SetCgoTraceback(int, unsafe.Pointer, unsafe.Pointer, unsafe.Pointer)
|
||||
pkg runtime, method (*Frames) Next() (Frame, bool)
|
||||
pkg runtime, type Frame struct
|
||||
pkg runtime, type Frame struct, Entry uintptr
|
||||
pkg runtime, type Frame struct, File string
|
||||
pkg runtime, type Frame struct, Func *Func
|
||||
pkg runtime, type Frame struct, Function string
|
||||
pkg runtime, type Frame struct, Line int
|
||||
pkg runtime, type Frame struct, PC uintptr
|
||||
pkg runtime, type Frames struct
|
||||
pkg strings, method (*Reader) Reset(string)
|
||||
pkg syscall (linux-386), type SysProcAttr struct, Unshareflags uintptr
|
||||
pkg syscall (linux-386-cgo), type SysProcAttr struct, Unshareflags uintptr
|
||||
pkg syscall (linux-amd64), type SysProcAttr struct, Unshareflags uintptr
|
||||
pkg syscall (linux-amd64-cgo), type SysProcAttr struct, Unshareflags uintptr
|
||||
pkg syscall (linux-arm), type SysProcAttr struct, Unshareflags uintptr
|
||||
pkg syscall (linux-arm-cgo), type SysProcAttr struct, Unshareflags uintptr
|
||||
pkg testing, method (*B) Run(string, func(*B)) bool
|
||||
pkg testing, method (*T) Run(string, func(*T)) bool
|
||||
pkg testing, type InternalExample struct, Unordered bool
|
||||
pkg unicode, const Version = "9.0.0"
|
||||
pkg unicode, var Adlam *RangeTable
|
||||
pkg unicode, var Bhaiksuki *RangeTable
|
||||
pkg unicode, var Marchen *RangeTable
|
||||
pkg unicode, var Newa *RangeTable
|
||||
pkg unicode, var Osage *RangeTable
|
||||
pkg unicode, var Prepended_Concatenation_Mark *RangeTable
|
||||
pkg unicode, var Sentence_Terminal *RangeTable
|
||||
pkg unicode, var Tangut *RangeTable
|
||||
261
api/go1.8.txt
261
api/go1.8.txt
@@ -1,261 +0,0 @@
|
||||
pkg compress/gzip, const HuffmanOnly = -2
|
||||
pkg compress/gzip, const HuffmanOnly ideal-int
|
||||
pkg compress/zlib, const HuffmanOnly = -2
|
||||
pkg compress/zlib, const HuffmanOnly ideal-int
|
||||
pkg crypto/tls, const ECDSAWithP256AndSHA256 = 1027
|
||||
pkg crypto/tls, const ECDSAWithP256AndSHA256 SignatureScheme
|
||||
pkg crypto/tls, const ECDSAWithP384AndSHA384 = 1283
|
||||
pkg crypto/tls, const ECDSAWithP384AndSHA384 SignatureScheme
|
||||
pkg crypto/tls, const ECDSAWithP521AndSHA512 = 1539
|
||||
pkg crypto/tls, const ECDSAWithP521AndSHA512 SignatureScheme
|
||||
pkg crypto/tls, const PKCS1WithSHA1 = 513
|
||||
pkg crypto/tls, const PKCS1WithSHA1 SignatureScheme
|
||||
pkg crypto/tls, const PKCS1WithSHA256 = 1025
|
||||
pkg crypto/tls, const PKCS1WithSHA256 SignatureScheme
|
||||
pkg crypto/tls, const PKCS1WithSHA384 = 1281
|
||||
pkg crypto/tls, const PKCS1WithSHA384 SignatureScheme
|
||||
pkg crypto/tls, const PKCS1WithSHA512 = 1537
|
||||
pkg crypto/tls, const PKCS1WithSHA512 SignatureScheme
|
||||
pkg crypto/tls, const PSSWithSHA256 = 2052
|
||||
pkg crypto/tls, const PSSWithSHA256 SignatureScheme
|
||||
pkg crypto/tls, const PSSWithSHA384 = 2053
|
||||
pkg crypto/tls, const PSSWithSHA384 SignatureScheme
|
||||
pkg crypto/tls, const PSSWithSHA512 = 2054
|
||||
pkg crypto/tls, const PSSWithSHA512 SignatureScheme
|
||||
pkg crypto/tls, const TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 49187
|
||||
pkg crypto/tls, const TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 uint16
|
||||
pkg crypto/tls, const TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 = 52393
|
||||
pkg crypto/tls, const TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 uint16
|
||||
pkg crypto/tls, const TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 49191
|
||||
pkg crypto/tls, const TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 uint16
|
||||
pkg crypto/tls, const TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 = 52392
|
||||
pkg crypto/tls, const TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 uint16
|
||||
pkg crypto/tls, const TLS_RSA_WITH_AES_128_CBC_SHA256 = 60
|
||||
pkg crypto/tls, const TLS_RSA_WITH_AES_128_CBC_SHA256 uint16
|
||||
pkg crypto/tls, const X25519 = 29
|
||||
pkg crypto/tls, const X25519 CurveID
|
||||
pkg crypto/tls, method (*Config) Clone() *Config
|
||||
pkg crypto/tls, method (*Conn) CloseWrite() error
|
||||
pkg crypto/tls, type CertificateRequestInfo struct
|
||||
pkg crypto/tls, type CertificateRequestInfo struct, AcceptableCAs [][]uint8
|
||||
pkg crypto/tls, type CertificateRequestInfo struct, SignatureSchemes []SignatureScheme
|
||||
pkg crypto/tls, type ClientHelloInfo struct, Conn net.Conn
|
||||
pkg crypto/tls, type ClientHelloInfo struct, SignatureSchemes []SignatureScheme
|
||||
pkg crypto/tls, type ClientHelloInfo struct, SupportedProtos []string
|
||||
pkg crypto/tls, type ClientHelloInfo struct, SupportedVersions []uint16
|
||||
pkg crypto/tls, type Config struct, GetClientCertificate func(*CertificateRequestInfo) (*Certificate, error)
|
||||
pkg crypto/tls, type Config struct, GetConfigForClient func(*ClientHelloInfo) (*Config, error)
|
||||
pkg crypto/tls, type Config struct, KeyLogWriter io.Writer
|
||||
pkg crypto/tls, type Config struct, VerifyPeerCertificate func([][]uint8, [][]*x509.Certificate) error
|
||||
pkg crypto/tls, type SignatureScheme uint16
|
||||
pkg crypto/x509, const NameMismatch = 5
|
||||
pkg crypto/x509, const NameMismatch InvalidReason
|
||||
pkg crypto/x509, const SHA256WithRSAPSS = 13
|
||||
pkg crypto/x509, const SHA256WithRSAPSS SignatureAlgorithm
|
||||
pkg crypto/x509, const SHA384WithRSAPSS = 14
|
||||
pkg crypto/x509, const SHA384WithRSAPSS SignatureAlgorithm
|
||||
pkg crypto/x509, const SHA512WithRSAPSS = 15
|
||||
pkg crypto/x509, const SHA512WithRSAPSS SignatureAlgorithm
|
||||
pkg crypto/x509, type UnknownAuthorityError struct, Cert *Certificate
|
||||
pkg database/sql, const LevelDefault = 0
|
||||
pkg database/sql, const LevelDefault IsolationLevel
|
||||
pkg database/sql, const LevelLinearizable = 7
|
||||
pkg database/sql, const LevelLinearizable IsolationLevel
|
||||
pkg database/sql, const LevelReadCommitted = 2
|
||||
pkg database/sql, const LevelReadCommitted IsolationLevel
|
||||
pkg database/sql, const LevelReadUncommitted = 1
|
||||
pkg database/sql, const LevelReadUncommitted IsolationLevel
|
||||
pkg database/sql, const LevelRepeatableRead = 4
|
||||
pkg database/sql, const LevelRepeatableRead IsolationLevel
|
||||
pkg database/sql, const LevelSerializable = 6
|
||||
pkg database/sql, const LevelSerializable IsolationLevel
|
||||
pkg database/sql, const LevelSnapshot = 5
|
||||
pkg database/sql, const LevelSnapshot IsolationLevel
|
||||
pkg database/sql, const LevelWriteCommitted = 3
|
||||
pkg database/sql, const LevelWriteCommitted IsolationLevel
|
||||
pkg database/sql/driver, type ConnBeginTx interface { BeginTx }
|
||||
pkg database/sql/driver, type ConnBeginTx interface, BeginTx(context.Context, TxOptions) (Tx, error)
|
||||
pkg database/sql/driver, type ConnPrepareContext interface { PrepareContext }
|
||||
pkg database/sql/driver, type ConnPrepareContext interface, PrepareContext(context.Context, string) (Stmt, error)
|
||||
pkg database/sql/driver, type ExecerContext interface { ExecContext }
|
||||
pkg database/sql/driver, type ExecerContext interface, ExecContext(context.Context, string, []NamedValue) (Result, error)
|
||||
pkg database/sql/driver, type IsolationLevel int
|
||||
pkg database/sql/driver, type NamedValue struct
|
||||
pkg database/sql/driver, type NamedValue struct, Name string
|
||||
pkg database/sql/driver, type NamedValue struct, Ordinal int
|
||||
pkg database/sql/driver, type NamedValue struct, Value Value
|
||||
pkg database/sql/driver, type Pinger interface { Ping }
|
||||
pkg database/sql/driver, type Pinger interface, Ping(context.Context) error
|
||||
pkg database/sql/driver, type QueryerContext interface { QueryContext }
|
||||
pkg database/sql/driver, type QueryerContext interface, QueryContext(context.Context, string, []NamedValue) (Rows, error)
|
||||
pkg database/sql/driver, type RowsColumnTypeDatabaseTypeName interface { Close, ColumnTypeDatabaseTypeName, Columns, Next }
|
||||
pkg database/sql/driver, type RowsColumnTypeDatabaseTypeName interface, Close() error
|
||||
pkg database/sql/driver, type RowsColumnTypeDatabaseTypeName interface, Columns() []string
|
||||
pkg database/sql/driver, type RowsColumnTypeDatabaseTypeName interface, ColumnTypeDatabaseTypeName(int) string
|
||||
pkg database/sql/driver, type RowsColumnTypeDatabaseTypeName interface, Next([]Value) error
|
||||
pkg database/sql/driver, type RowsColumnTypeLength interface { Close, ColumnTypeLength, Columns, Next }
|
||||
pkg database/sql/driver, type RowsColumnTypeLength interface, Close() error
|
||||
pkg database/sql/driver, type RowsColumnTypeLength interface, Columns() []string
|
||||
pkg database/sql/driver, type RowsColumnTypeLength interface, ColumnTypeLength(int) (int64, bool)
|
||||
pkg database/sql/driver, type RowsColumnTypeLength interface, Next([]Value) error
|
||||
pkg database/sql/driver, type RowsColumnTypeNullable interface { Close, ColumnTypeNullable, Columns, Next }
|
||||
pkg database/sql/driver, type RowsColumnTypeNullable interface, Close() error
|
||||
pkg database/sql/driver, type RowsColumnTypeNullable interface, Columns() []string
|
||||
pkg database/sql/driver, type RowsColumnTypeNullable interface, ColumnTypeNullable(int) (bool, bool)
|
||||
pkg database/sql/driver, type RowsColumnTypeNullable interface, Next([]Value) error
|
||||
pkg database/sql/driver, type RowsColumnTypePrecisionScale interface { Close, ColumnTypePrecisionScale, Columns, Next }
|
||||
pkg database/sql/driver, type RowsColumnTypePrecisionScale interface, Close() error
|
||||
pkg database/sql/driver, type RowsColumnTypePrecisionScale interface, Columns() []string
|
||||
pkg database/sql/driver, type RowsColumnTypePrecisionScale interface, ColumnTypePrecisionScale(int) (int64, int64, bool)
|
||||
pkg database/sql/driver, type RowsColumnTypePrecisionScale interface, Next([]Value) error
|
||||
pkg database/sql/driver, type RowsColumnTypeScanType interface { Close, ColumnTypeScanType, Columns, Next }
|
||||
pkg database/sql/driver, type RowsColumnTypeScanType interface, Close() error
|
||||
pkg database/sql/driver, type RowsColumnTypeScanType interface, Columns() []string
|
||||
pkg database/sql/driver, type RowsColumnTypeScanType interface, ColumnTypeScanType(int) reflect.Type
|
||||
pkg database/sql/driver, type RowsColumnTypeScanType interface, Next([]Value) error
|
||||
pkg database/sql/driver, type RowsNextResultSet interface { Close, Columns, HasNextResultSet, Next, NextResultSet }
|
||||
pkg database/sql/driver, type RowsNextResultSet interface, Close() error
|
||||
pkg database/sql/driver, type RowsNextResultSet interface, Columns() []string
|
||||
pkg database/sql/driver, type RowsNextResultSet interface, HasNextResultSet() bool
|
||||
pkg database/sql/driver, type RowsNextResultSet interface, NextResultSet() error
|
||||
pkg database/sql/driver, type RowsNextResultSet interface, Next([]Value) error
|
||||
pkg database/sql/driver, type StmtExecContext interface { ExecContext }
|
||||
pkg database/sql/driver, type StmtExecContext interface, ExecContext(context.Context, []NamedValue) (Result, error)
|
||||
pkg database/sql/driver, type StmtQueryContext interface { QueryContext }
|
||||
pkg database/sql/driver, type StmtQueryContext interface, QueryContext(context.Context, []NamedValue) (Rows, error)
|
||||
pkg database/sql/driver, type TxOptions struct
|
||||
pkg database/sql/driver, type TxOptions struct, Isolation IsolationLevel
|
||||
pkg database/sql/driver, type TxOptions struct, ReadOnly bool
|
||||
pkg database/sql, func Named(string, interface{}) NamedArg
|
||||
pkg database/sql, method (*ColumnType) DatabaseTypeName() string
|
||||
pkg database/sql, method (*ColumnType) DecimalSize() (int64, int64, bool)
|
||||
pkg database/sql, method (*ColumnType) Length() (int64, bool)
|
||||
pkg database/sql, method (*ColumnType) Name() string
|
||||
pkg database/sql, method (*ColumnType) Nullable() (bool, bool)
|
||||
pkg database/sql, method (*ColumnType) ScanType() reflect.Type
|
||||
pkg database/sql, method (*DB) BeginTx(context.Context, *TxOptions) (*Tx, error)
|
||||
pkg database/sql, method (*DB) ExecContext(context.Context, string, ...interface{}) (Result, error)
|
||||
pkg database/sql, method (*DB) PingContext(context.Context) error
|
||||
pkg database/sql, method (*DB) PrepareContext(context.Context, string) (*Stmt, error)
|
||||
pkg database/sql, method (*DB) QueryContext(context.Context, string, ...interface{}) (*Rows, error)
|
||||
pkg database/sql, method (*DB) QueryRowContext(context.Context, string, ...interface{}) *Row
|
||||
pkg database/sql, method (*Rows) ColumnTypes() ([]*ColumnType, error)
|
||||
pkg database/sql, method (*Rows) NextResultSet() bool
|
||||
pkg database/sql, method (*Stmt) ExecContext(context.Context, ...interface{}) (Result, error)
|
||||
pkg database/sql, method (*Stmt) QueryContext(context.Context, ...interface{}) (*Rows, error)
|
||||
pkg database/sql, method (*Stmt) QueryRowContext(context.Context, ...interface{}) *Row
|
||||
pkg database/sql, method (*Tx) ExecContext(context.Context, string, ...interface{}) (Result, error)
|
||||
pkg database/sql, method (*Tx) PrepareContext(context.Context, string) (*Stmt, error)
|
||||
pkg database/sql, method (*Tx) QueryContext(context.Context, string, ...interface{}) (*Rows, error)
|
||||
pkg database/sql, method (*Tx) QueryRowContext(context.Context, string, ...interface{}) *Row
|
||||
pkg database/sql, method (*Tx) StmtContext(context.Context, *Stmt) *Stmt
|
||||
pkg database/sql, type ColumnType struct
|
||||
pkg database/sql, type IsolationLevel int
|
||||
pkg database/sql, type NamedArg struct
|
||||
pkg database/sql, type NamedArg struct, Name string
|
||||
pkg database/sql, type NamedArg struct, Value interface{}
|
||||
pkg database/sql, type TxOptions struct
|
||||
pkg database/sql, type TxOptions struct, Isolation IsolationLevel
|
||||
pkg database/sql, type TxOptions struct, ReadOnly bool
|
||||
pkg debug/pe, method (*COFFSymbol) FullName(StringTable) (string, error)
|
||||
pkg debug/pe, method (StringTable) String(uint32) (string, error)
|
||||
pkg debug/pe, type File struct, COFFSymbols []COFFSymbol
|
||||
pkg debug/pe, type File struct, StringTable StringTable
|
||||
pkg debug/pe, type Reloc struct
|
||||
pkg debug/pe, type Reloc struct, SymbolTableIndex uint32
|
||||
pkg debug/pe, type Reloc struct, Type uint16
|
||||
pkg debug/pe, type Reloc struct, VirtualAddress uint32
|
||||
pkg debug/pe, type Section struct, Relocs []Reloc
|
||||
pkg debug/pe, type StringTable []uint8
|
||||
pkg encoding/base64, method (Encoding) Strict() *Encoding
|
||||
pkg encoding/json, method (RawMessage) MarshalJSON() ([]uint8, error)
|
||||
pkg encoding/json, type UnmarshalTypeError struct, Field string
|
||||
pkg encoding/json, type UnmarshalTypeError struct, Struct string
|
||||
pkg expvar, func Handler() http.Handler
|
||||
pkg expvar, method (*Float) Value() float64
|
||||
pkg expvar, method (Func) Value() interface{}
|
||||
pkg expvar, method (*Int) Value() int64
|
||||
pkg expvar, method (*String) Value() string
|
||||
pkg go/doc, func IsPredeclared(string) bool
|
||||
pkg go/types, func Default(Type) Type
|
||||
pkg go/types, func IdenticalIgnoreTags(Type, Type) bool
|
||||
pkg math/big, method (*Float) Scan(fmt.ScanState, int32) error
|
||||
pkg math/big, method (*Int) Sqrt(*Int) *Int
|
||||
pkg math/rand, func Uint64() uint64
|
||||
pkg math/rand, method (*Rand) Uint64() uint64
|
||||
pkg math/rand, type Source64 interface, Int63() int64
|
||||
pkg math/rand, type Source64 interface { Int63, Seed, Uint64 }
|
||||
pkg math/rand, type Source64 interface, Seed(int64)
|
||||
pkg math/rand, type Source64 interface, Uint64() uint64
|
||||
pkg net/http, const TrailerPrefix ideal-string
|
||||
pkg net/http, const TrailerPrefix = "Trailer:"
|
||||
pkg net/http/httptrace, type ClientTrace struct, TLSHandshakeDone func(tls.ConnectionState, error)
|
||||
pkg net/http/httptrace, type ClientTrace struct, TLSHandshakeStart func()
|
||||
pkg net/http/httputil, type ReverseProxy struct, ModifyResponse func(*http.Response) error
|
||||
pkg net/http, method (*Server) Close() error
|
||||
pkg net/http, method (*Server) Shutdown(context.Context) error
|
||||
pkg net/http, type Pusher interface { Push }
|
||||
pkg net/http, type Pusher interface, Push(string, *PushOptions) error
|
||||
pkg net/http, type PushOptions struct
|
||||
pkg net/http, type PushOptions struct, Header Header
|
||||
pkg net/http, type PushOptions struct, Method string
|
||||
pkg net/http, type Request struct, GetBody func() (io.ReadCloser, error)
|
||||
pkg net/http, type Server struct, IdleTimeout time.Duration
|
||||
pkg net/http, type Server struct, ReadHeaderTimeout time.Duration
|
||||
pkg net/http, type Transport struct, ProxyConnectHeader Header
|
||||
pkg net/http, var ErrAbortHandler error
|
||||
pkg net/http, var ErrServerClosed error
|
||||
pkg net/http, var NoBody noBody
|
||||
pkg net/mail, func ParseDate(string) (time.Time, error)
|
||||
pkg net, method (*Buffers) Read([]uint8) (int, error)
|
||||
pkg net, method (*Buffers) WriteTo(io.Writer) (int64, error)
|
||||
pkg net, method (*Resolver) LookupAddr(context.Context, string) ([]string, error)
|
||||
pkg net, method (*Resolver) LookupCNAME(context.Context, string) (string, error)
|
||||
pkg net, method (*Resolver) LookupHost(context.Context, string) ([]string, error)
|
||||
pkg net, method (*Resolver) LookupIPAddr(context.Context, string) ([]IPAddr, error)
|
||||
pkg net, method (*Resolver) LookupMX(context.Context, string) ([]*MX, error)
|
||||
pkg net, method (*Resolver) LookupNS(context.Context, string) ([]*NS, error)
|
||||
pkg net, method (*Resolver) LookupPort(context.Context, string, string) (int, error)
|
||||
pkg net, method (*Resolver) LookupSRV(context.Context, string, string, string) (string, []*SRV, error)
|
||||
pkg net, method (*Resolver) LookupTXT(context.Context, string) ([]string, error)
|
||||
pkg net, method (*UnixListener) SetUnlinkOnClose(bool)
|
||||
pkg net, type Buffers [][]uint8
|
||||
pkg net, type Dialer struct, Resolver *Resolver
|
||||
pkg net, type Resolver struct
|
||||
pkg net, type Resolver struct, PreferGo bool
|
||||
pkg net/url, func PathEscape(string) string
|
||||
pkg net/url, func PathUnescape(string) (string, error)
|
||||
pkg net/url, method (*URL) Hostname() string
|
||||
pkg net/url, method (*URL) MarshalBinary() ([]uint8, error)
|
||||
pkg net/url, method (*URL) Port() string
|
||||
pkg net/url, method (*URL) UnmarshalBinary([]uint8) error
|
||||
pkg net, var DefaultResolver *Resolver
|
||||
pkg os, func Executable() (string, error)
|
||||
pkg os, var ErrClosed error
|
||||
pkg plugin, func Open(string) (*Plugin, error)
|
||||
pkg plugin, method (*Plugin) Lookup(string) (Symbol, error)
|
||||
pkg plugin, type Plugin struct
|
||||
pkg plugin, type Symbol interface {}
|
||||
pkg reflect, func Swapper(interface{}) func(int, int)
|
||||
pkg runtime, func MutexProfile([]BlockProfileRecord) (int, bool)
|
||||
pkg runtime, func SetMutexProfileFraction(int) int
|
||||
pkg runtime, type MemStats struct, NumForcedGC uint32
|
||||
pkg sort, func Slice(interface{}, func(int, int) bool)
|
||||
pkg sort, func SliceIsSorted(interface{}, func(int, int) bool) bool
|
||||
pkg sort, func SliceStable(interface{}, func(int, int) bool)
|
||||
pkg syscall (linux-arm-cgo), func TimevalToNsec(Timeval) int64
|
||||
pkg syscall (linux-arm), func TimevalToNsec(Timeval) int64
|
||||
pkg syscall (openbsd-386), const SYS_KILL = 122
|
||||
pkg syscall (openbsd-386-cgo), const SYS_KILL = 122
|
||||
pkg syscall (openbsd-amd64), const SYS_KILL = 122
|
||||
pkg syscall (openbsd-amd64-cgo), const SYS_KILL = 122
|
||||
pkg syscall (windows-386), const ERROR_DIR_NOT_EMPTY = 145
|
||||
pkg syscall (windows-386), const ERROR_DIR_NOT_EMPTY Errno
|
||||
pkg syscall (windows-amd64), const ERROR_DIR_NOT_EMPTY = 145
|
||||
pkg syscall (windows-amd64), const ERROR_DIR_NOT_EMPTY Errno
|
||||
pkg testing, func CoverMode() string
|
||||
pkg testing, func MainStart(testDeps, []InternalTest, []InternalBenchmark, []InternalExample) *M
|
||||
pkg testing, method (*B) Name() string
|
||||
pkg testing, method (*T) Name() string
|
||||
pkg testing, type TB interface, Name() string
|
||||
pkg time, func Until(Time) Duration
|
||||
30871
api/go1.txt
30871
api/go1.txt
File diff suppressed because it is too large
Load Diff
BIN
doc/ExpressivenessOfGo.pdf
Normal file
BIN
doc/ExpressivenessOfGo.pdf
Normal file
Binary file not shown.
BIN
doc/GoCourseDay1.pdf
Normal file
BIN
doc/GoCourseDay1.pdf
Normal file
Binary file not shown.
BIN
doc/GoCourseDay2.pdf
Normal file
BIN
doc/GoCourseDay2.pdf
Normal file
Binary file not shown.
BIN
doc/GoCourseDay3.pdf
Normal file
BIN
doc/GoCourseDay3.pdf
Normal file
Binary file not shown.
11
doc/Makefile
Normal file
11
doc/Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
include ../src/Make.inc
|
||||
|
||||
TARG=htmlgen
|
||||
GOFILES=\
|
||||
htmlgen.go\
|
||||
|
||||
include ../src/Make.cmd
|
||||
200
doc/all.css
Normal file
200
doc/all.css
Normal file
@@ -0,0 +1,200 @@
|
||||
/* General Styles */
|
||||
body {
|
||||
font-family: "Bitstream Vera Sans", Verdana, sans-serif;
|
||||
font-size: 81.25%;
|
||||
line-height: 1.23em;
|
||||
padding: 0;
|
||||
margin: 1.23em;
|
||||
background: white;
|
||||
color: black;
|
||||
}
|
||||
a {
|
||||
color: #04a;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
color: #04a;
|
||||
}
|
||||
a:hover {
|
||||
color: #a40;
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:active {
|
||||
color: #c00;
|
||||
}
|
||||
code, pre {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
pre {
|
||||
background: #F0F0F0;
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
|
||||
/* Top bar */
|
||||
#container {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
}
|
||||
#topnav {
|
||||
height: 55px;
|
||||
background: url(/doc/logo.png) no-repeat top left;
|
||||
}
|
||||
a#logo-box {
|
||||
display: block;
|
||||
height: 55px;
|
||||
}
|
||||
h1#title {
|
||||
display: none;
|
||||
}
|
||||
#nav-main {
|
||||
float: right;
|
||||
width: 500px;
|
||||
margin-top: -5px;
|
||||
text-align: center;
|
||||
}
|
||||
#nav-main ul {
|
||||
padding-left: 0;
|
||||
margin-left: 0;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
#nav-main li a {
|
||||
display: inline;
|
||||
display: inline-block;
|
||||
padding: .46em .62em .38em .62em;
|
||||
}
|
||||
#nav-main li a:link,
|
||||
#nav-main li a:visited {
|
||||
color: #000;
|
||||
}
|
||||
#nav-main li {
|
||||
display: inline;
|
||||
display: inline-block;
|
||||
background: #e6e6e6 url(/doc/button_background.png) repeat-x;
|
||||
border: solid 1px #999;
|
||||
margin-left: -1px;
|
||||
text-shadow: #fff 0 1px 0;
|
||||
box-shadow: 0 1px 1px #ccc;
|
||||
-moz-box-shadow: 0 1px 1px #ccc;
|
||||
-webkit-box-shadow: 0 1px 1px #ccc;
|
||||
}
|
||||
#nav-main li:first-child {
|
||||
-moz-border-top-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
-moz-border-bottom-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
#nav-main li:last-child {
|
||||
-moz-border-top-right-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
-moz-border-bottom-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
#nav-main .quickref {
|
||||
color: #444;
|
||||
}
|
||||
#nav-main .quickref .sep {
|
||||
color: #999;
|
||||
}
|
||||
#search {
|
||||
width: 120px;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
#search.inactive {
|
||||
text-align: center;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
#site-info {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
#site-info, #site-info a:link, #site-info a:visited {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
/* Content */
|
||||
#content {
|
||||
clear: both;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 1.5em;
|
||||
border-top: solid 1px #aaa;
|
||||
border-bottom: solid 1px #aaa;
|
||||
}
|
||||
.left-column {
|
||||
width: 49%;
|
||||
float: left;
|
||||
}
|
||||
.right-column {
|
||||
width: 49%;
|
||||
float: right;
|
||||
}
|
||||
.end-columns {
|
||||
clear: both;
|
||||
}
|
||||
#content h1 {
|
||||
margin-bottom: -0em;
|
||||
padding: 0;
|
||||
}
|
||||
#content h2 {
|
||||
border-top: 2px solid #ddd;
|
||||
padding: 8px 5px;
|
||||
margin: 1.5em 0 0;
|
||||
}
|
||||
#content .subtitle {
|
||||
margin-top: 1em;
|
||||
display: block;
|
||||
}
|
||||
.navtop a {
|
||||
font-weight: normal; font-size: 7pt;
|
||||
float: right; color: #999;
|
||||
}
|
||||
|
||||
/* Content and Code Highlighting */
|
||||
pre.ebnf, pre.grammar {
|
||||
background: #FFFFE0;
|
||||
}
|
||||
span.ln {
|
||||
font-size: 80%;
|
||||
color: #777777;
|
||||
}
|
||||
span.comment {
|
||||
color: #002090;
|
||||
}
|
||||
span.highlight {
|
||||
background: #FF9900;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.highlight-comment {
|
||||
background: #FF9900;
|
||||
font-weight: bold;
|
||||
color: #002090;
|
||||
}
|
||||
span.selection {
|
||||
background: #FFFF00
|
||||
}
|
||||
span.selection-comment {
|
||||
color: #002090;
|
||||
background: #FFFF00
|
||||
}
|
||||
span.selection-highlight {
|
||||
background: #FF9900;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.selection-highlight-comment {
|
||||
background: #FF9900;
|
||||
font-weight: bold;
|
||||
color: #002090;
|
||||
}
|
||||
span.alert {
|
||||
color: #D00000;
|
||||
}
|
||||
#nav table {
|
||||
width: 100%;
|
||||
}
|
||||
.detail {
|
||||
padding: 0.25em 1em;
|
||||
background: #F4F4F4;
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
<!--{
|
||||
"title": "About the go command"
|
||||
}-->
|
||||
|
||||
<p>The Go distribution includes a command, named
|
||||
"<code><a href="/cmd/go/">go</a></code>", that
|
||||
automates the downloading, building, installation, and testing of Go packages
|
||||
and commands. This document talks about why we wrote a new command, what it
|
||||
is, what it's not, and how to use it.</p>
|
||||
|
||||
<h2>Motivation</h2>
|
||||
|
||||
<p>You might have seen early Go talks in which Rob Pike jokes that the idea
|
||||
for Go arose while waiting for a large Google server to compile. That
|
||||
really was the motivation for Go: to build a language that worked well
|
||||
for building the large software that Google writes and runs. It was
|
||||
clear from the start that such a language must provide a way to
|
||||
express dependencies between code libraries clearly, hence the package
|
||||
grouping and the explicit import blocks. It was also clear from the
|
||||
start that you might want arbitrary syntax for describing the code
|
||||
being imported; this is why import paths are string literals.</p>
|
||||
|
||||
<p>An explicit goal for Go from the beginning was to be able to build Go
|
||||
code using only the information found in the source itself, not
|
||||
needing to write a makefile or one of the many modern replacements for
|
||||
makefiles. If Go needed a configuration file to explain how to build
|
||||
your program, then Go would have failed.</p>
|
||||
|
||||
<p>At first, there was no Go compiler, and the initial development
|
||||
focused on building one and then building libraries for it. For
|
||||
expedience, we postponed the automation of building Go code by using
|
||||
make and writing makefiles. When compiling a single package involved
|
||||
multiple invocations of the Go compiler, we even used a program to
|
||||
write the makefiles for us. You can find it if you dig through the
|
||||
repository history.</p>
|
||||
|
||||
<p>The purpose of the new go command is our return to this ideal, that Go
|
||||
programs should compile without configuration or additional effort on
|
||||
the part of the developer beyond writing the necessary import
|
||||
statements.</p>
|
||||
|
||||
<h2>Configuration versus convention</h2>
|
||||
|
||||
<p>The way to achieve the simplicity of a configuration-free system is to
|
||||
establish conventions. The system works only to the extent that those conventions
|
||||
are followed. When we first launched Go, many people published packages that
|
||||
had to be installed in certain places, under certain names, using certain build
|
||||
tools, in order to be used. That's understandable: that's the way it works in
|
||||
most other languages. Over the last few years we consistently reminded people
|
||||
about the <code>goinstall</code> command
|
||||
(now replaced by <a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies"><code>go get</code></a>)
|
||||
and its conventions: first, that the import path is derived in a known way from
|
||||
the URL of the source code; second, that the place to store the sources in
|
||||
the local file system is derived in a known way from the import path; third,
|
||||
that each directory in a source tree corresponds to a single package; and
|
||||
fourth, that the package is built using only information in the source code.
|
||||
Today, the vast majority of packages follow these conventions.
|
||||
The Go ecosystem is simpler and more powerful as a result.</p>
|
||||
|
||||
<p>We received many requests to allow a makefile in a package directory to
|
||||
provide just a little extra configuration beyond what's in the source code.
|
||||
But that would have introduced new rules. Because we did not accede to such
|
||||
requests, we were able to write the go command and eliminate our use of make
|
||||
or any other build system.</p>
|
||||
|
||||
<p>It is important to understand that the go command is not a general
|
||||
build tool. It cannot be configured and it does not attempt to build
|
||||
anything but Go packages. These are important simplifying
|
||||
assumptions: they simplify not only the implementation but also, more
|
||||
important, the use of the tool itself.</p>
|
||||
|
||||
<h2>Go's conventions</h2>
|
||||
|
||||
<p>The <code>go</code> command requires that code adheres to a few key,
|
||||
well-established conventions.</p>
|
||||
|
||||
<p>First, the import path is derived in an known way from the URL of the
|
||||
source code. For Bitbucket, GitHub, Google Code, and Launchpad, the
|
||||
root directory of the repository is identified by the repository's
|
||||
main URL, without the <code>http://</code> prefix. Subdirectories are named by
|
||||
adding to that path.
|
||||
For example, the Go example programs are obtained by running</p>
|
||||
|
||||
<pre>
|
||||
git clone https://github.com/golang/example
|
||||
</pre>
|
||||
|
||||
<p>and thus the import path for the root directory of that repository is
|
||||
"<code>github.com/golang/example</code>".
|
||||
The <a href="https://godoc.org/github.com/golang/example/stringutil">stringutil</a>
|
||||
package is stored in a subdirectory, so its import path is
|
||||
"<code>github.com/golang/example/stringutil</code>".</p>
|
||||
|
||||
<p>These paths are on the long side, but in exchange we get an
|
||||
automatically managed name space for import paths and the ability for
|
||||
a tool like the go command to look at an unfamiliar import path and
|
||||
deduce where to obtain the source code.</p>
|
||||
|
||||
<p>Second, the place to store sources in the local file system is derived
|
||||
in a known way from the import path, specifically
|
||||
<code>$GOPATH/src/<import-path></code>.
|
||||
If unset, <code>$GOPATH</code> defaults to a subdirectory
|
||||
named <code>go</code> in the user's home directory.
|
||||
If <code>$GOPATH</code> is set to a list of paths, the go command tries
|
||||
<code><dir>/src/<import-path></code> for each of the directories in
|
||||
that list.
|
||||
</p>
|
||||
|
||||
<p>Each of those trees contains, by convention, a top-level directory named
|
||||
"<code>bin</code>", for holding compiled executables, and a top-level directory
|
||||
named "<code>pkg</code>", for holding compiled packages that can be imported,
|
||||
and the "<code>src</code>" directory, for holding package source files.
|
||||
Imposing this structure lets us keep each of these directory trees
|
||||
self-contained: the compiled form and the sources are always near each
|
||||
other.</p>
|
||||
|
||||
<p>These naming conventions also let us work in the reverse direction,
|
||||
from a directory name to its import path. This mapping is important
|
||||
for many of the go command's subcommands, as we'll see below.</p>
|
||||
|
||||
<p>Third, each directory in a source tree corresponds to a single
|
||||
package. By restricting a directory to a single package, we don't have
|
||||
to create hybrid import paths that specify first the directory and
|
||||
then the package within that directory. Also, most file management
|
||||
tools and UIs work on directories as fundamental units. Tying the
|
||||
fundamental Go unit—the package—to file system structure means
|
||||
that file system tools become Go package tools. Copying, moving, or
|
||||
deleting a package corresponds to copying, moving, or deleting a
|
||||
directory.</p>
|
||||
|
||||
<p>Fourth, each package is built using only the information present in
|
||||
the source files. This makes it much more likely that the tool will
|
||||
be able to adapt to changing build environments and conditions. For
|
||||
example, if we allowed extra configuration such as compiler flags or
|
||||
command line recipes, then that configuration would need to be updated
|
||||
each time the build tools changed; it would also be inherently tied
|
||||
to the use of a specific tool chain.</p>
|
||||
|
||||
<h2>Getting started with the go command</h2>
|
||||
|
||||
<p>Finally, a quick tour of how to use the go command.
|
||||
As mentioned above, the default <code>$GOPATH</code> on Unix is <code>$HOME/go</code>.
|
||||
We'll store our programs there.
|
||||
To use a different location, you can set <code>$GOPATH</code>;
|
||||
see <a href="/doc/code.html">How to Write Go Code</a> for details.
|
||||
|
||||
<p>We first add some source code. Suppose we want to use
|
||||
the indexing library from the codesearch project along with a left-leaning
|
||||
red-black tree. We can install both with the "<code>go get</code>"
|
||||
subcommand:</p>
|
||||
|
||||
<pre>
|
||||
$ go get github.com/google/codesearch/index
|
||||
$ go get github.com/petar/GoLLRB/llrb
|
||||
$
|
||||
</pre>
|
||||
|
||||
<p>Both of these projects are now downloaded and installed into <code>$HOME/go</code>,
|
||||
which contains the two directories
|
||||
<code>src/github.com/google/codesearch/index/</code> and
|
||||
<code>src/github.com/petar/GoLLRB/llrb/</code>, along with the compiled
|
||||
packages (in <code>pkg/</code>) for those libraries and their dependencies.</p>
|
||||
|
||||
<p>Because we used version control systems (Mercurial and Git) to check
|
||||
out the sources, the source tree also contains the other files in the
|
||||
corresponding repositories, such as related packages. The "<code>go list</code>"
|
||||
subcommand lists the import paths corresponding to its arguments, and
|
||||
the pattern "<code>./...</code>" means start in the current directory
|
||||
("<code>./</code>") and find all packages below that directory
|
||||
("<code>...</code>"):</p>
|
||||
|
||||
<pre>
|
||||
$ cd $HOME/go/src
|
||||
$ go list ./...
|
||||
github.com/google/codesearch/cmd/cgrep
|
||||
github.com/google/codesearch/cmd/cindex
|
||||
github.com/google/codesearch/cmd/csearch
|
||||
github.com/google/codesearch/index
|
||||
github.com/google/codesearch/regexp
|
||||
github.com/google/codesearch/sparse
|
||||
github.com/petar/GoLLRB/example
|
||||
github.com/petar/GoLLRB/llrb
|
||||
$
|
||||
</pre>
|
||||
|
||||
<p>We can also test those packages:</p>
|
||||
|
||||
<pre>
|
||||
$ go test ./...
|
||||
? github.com/google/codesearch/cmd/cgrep [no test files]
|
||||
? github.com/google/codesearch/cmd/cindex [no test files]
|
||||
? github.com/google/codesearch/cmd/csearch [no test files]
|
||||
ok github.com/google/codesearch/index 0.203s
|
||||
ok github.com/google/codesearch/regexp 0.017s
|
||||
? github.com/google/codesearch/sparse [no test files]
|
||||
? github.com/petar/GoLLRB/example [no test files]
|
||||
ok github.com/petar/GoLLRB/llrb 0.231s
|
||||
$
|
||||
</pre>
|
||||
|
||||
<p>If a go subcommand is invoked with no paths listed, it operates on the
|
||||
current directory:</p>
|
||||
|
||||
<pre>
|
||||
$ cd github.com/google/codesearch/regexp
|
||||
$ go list
|
||||
github.com/google/codesearch/regexp
|
||||
$ go test -v
|
||||
=== RUN TestNstateEnc
|
||||
--- PASS: TestNstateEnc (0.00s)
|
||||
=== RUN TestMatch
|
||||
--- PASS: TestMatch (0.00s)
|
||||
=== RUN TestGrep
|
||||
--- PASS: TestGrep (0.00s)
|
||||
PASS
|
||||
ok github.com/google/codesearch/regexp 0.018s
|
||||
$ go install
|
||||
$
|
||||
</pre>
|
||||
|
||||
<p>That "<code>go install</code>" subcommand installs the latest copy of the
|
||||
package into the pkg directory. Because the go command can analyze the
|
||||
dependency graph, "<code>go install</code>" also installs any packages that
|
||||
this package imports but that are out of date, recursively.</p>
|
||||
|
||||
<p>Notice that "<code>go install</code>" was able to determine the name of the
|
||||
import path for the package in the current directory, because of the convention
|
||||
for directory naming. It would be a little more convenient if we could pick
|
||||
the name of the directory where we kept source code, and we probably wouldn't
|
||||
pick such a long name, but that ability would require additional configuration
|
||||
and complexity in the tool. Typing an extra directory name or two is a small
|
||||
price to pay for the increased simplicity and power.</p>
|
||||
|
||||
<h2>Limitations</h2>
|
||||
|
||||
<p>As mentioned above, the go command is not a general-purpose build
|
||||
tool.
|
||||
In particular, it does not have any facility for generating Go
|
||||
source files <em>during</em> a build, although it does provide
|
||||
<a href="/cmd/go/#hdr-Generate_Go_files_by_processing_source"><code>go</code>
|
||||
<code>generate</code></a>,
|
||||
which can automate the creation of Go files <em>before</em> the build.
|
||||
For more advanced build setups, you may need to write a
|
||||
makefile (or a configuration file for the build tool of your choice)
|
||||
to run whatever tool creates the Go files and then check those generated source files
|
||||
into your repository. This is more work for you, the package author,
|
||||
but it is significantly less work for your users, who can use
|
||||
"<code>go get</code>" without needing to obtain and build
|
||||
any additional tools.</p>
|
||||
|
||||
<h2>More information</h2>
|
||||
|
||||
<p>For more information, read <a href="/doc/code.html">How to Write Go Code</a>
|
||||
and see the <a href="/cmd/go/">go command documentation</a>.</p>
|
||||
@@ -1,8 +0,0 @@
|
||||
<!--{
|
||||
"Title": "/doc/articles/"
|
||||
}-->
|
||||
|
||||
<p>
|
||||
See the <a href="/doc/#articles">Documents page</a> and the
|
||||
<a href="/blog/index">Blog index</a> for a complete list of Go articles.
|
||||
</p>
|
||||
@@ -1,389 +0,0 @@
|
||||
<!--{
|
||||
"Title": "Data Race Detector",
|
||||
"Template": true
|
||||
}-->
|
||||
|
||||
<h2 id="Introduction">Introduction</h2>
|
||||
|
||||
<p>
|
||||
Data races are among the most common and hardest to debug types of bugs in concurrent systems.
|
||||
A data race occurs when two goroutines access the same variable concurrently and at least one of the accesses is a write.
|
||||
See the <a href="/ref/mem/">The Go Memory Model</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Here is an example of a data race that can lead to crashes and memory corruption:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
func main() {
|
||||
c := make(chan bool)
|
||||
m := make(map[string]string)
|
||||
go func() {
|
||||
m["1"] = "a" // First conflicting access.
|
||||
c <- true
|
||||
}()
|
||||
m["2"] = "b" // Second conflicting access.
|
||||
<-c
|
||||
for k, v := range m {
|
||||
fmt.Println(k, v)
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h2 id="Usage">Usage</h2>
|
||||
|
||||
<p>
|
||||
To help diagnose such bugs, Go includes a built-in data race detector.
|
||||
To use it, add the <code>-race</code> flag to the go command:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ go test -race mypkg // to test the package
|
||||
$ go run -race mysrc.go // to run the source file
|
||||
$ go build -race mycmd // to build the command
|
||||
$ go install -race mypkg // to install the package
|
||||
</pre>
|
||||
|
||||
<h2 id="Report_Format">Report Format</h2>
|
||||
|
||||
<p>
|
||||
When the race detector finds a data race in the program, it prints a report.
|
||||
The report contains stack traces for conflicting accesses, as well as stacks where the involved goroutines were created.
|
||||
Here is an example:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
WARNING: DATA RACE
|
||||
Read by goroutine 185:
|
||||
net.(*pollServer).AddFD()
|
||||
src/net/fd_unix.go:89 +0x398
|
||||
net.(*pollServer).WaitWrite()
|
||||
src/net/fd_unix.go:247 +0x45
|
||||
net.(*netFD).Write()
|
||||
src/net/fd_unix.go:540 +0x4d4
|
||||
net.(*conn).Write()
|
||||
src/net/net.go:129 +0x101
|
||||
net.func·060()
|
||||
src/net/timeout_test.go:603 +0xaf
|
||||
|
||||
Previous write by goroutine 184:
|
||||
net.setWriteDeadline()
|
||||
src/net/sockopt_posix.go:135 +0xdf
|
||||
net.setDeadline()
|
||||
src/net/sockopt_posix.go:144 +0x9c
|
||||
net.(*conn).SetDeadline()
|
||||
src/net/net.go:161 +0xe3
|
||||
net.func·061()
|
||||
src/net/timeout_test.go:616 +0x3ed
|
||||
|
||||
Goroutine 185 (running) created at:
|
||||
net.func·061()
|
||||
src/net/timeout_test.go:609 +0x288
|
||||
|
||||
Goroutine 184 (running) created at:
|
||||
net.TestProlongTimeout()
|
||||
src/net/timeout_test.go:618 +0x298
|
||||
testing.tRunner()
|
||||
src/testing/testing.go:301 +0xe8
|
||||
</pre>
|
||||
|
||||
<h2 id="Options">Options</h2>
|
||||
|
||||
<p>
|
||||
The <code>GORACE</code> environment variable sets race detector options.
|
||||
The format is:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
GORACE="option1=val1 option2=val2"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The options are:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<code>log_path</code> (default <code>stderr</code>): The race detector writes
|
||||
its report to a file named <code>log_path.<em>pid</em></code>.
|
||||
The special names <code>stdout</code>
|
||||
and <code>stderr</code> cause reports to be written to standard output and
|
||||
standard error, respectively.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>exitcode</code> (default <code>66</code>): The exit status to use when
|
||||
exiting after a detected race.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>strip_path_prefix</code> (default <code>""</code>): Strip this prefix
|
||||
from all reported file paths, to make reports more concise.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>history_size</code> (default <code>1</code>): The per-goroutine memory
|
||||
access history is <code>32K * 2**history_size elements</code>.
|
||||
Increasing this value can avoid a "failed to restore the stack" error in reports, at the
|
||||
cost of increased memory usage.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>halt_on_error</code> (default <code>0</code>): Controls whether the program
|
||||
exits after reporting first data race.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Example:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ GORACE="log_path=/tmp/race/report strip_path_prefix=/my/go/sources/" go test -race
|
||||
</pre>
|
||||
|
||||
<h2 id="Excluding_Tests">Excluding Tests</h2>
|
||||
|
||||
<p>
|
||||
When you build with <code>-race</code> flag, the <code>go</code> command defines additional
|
||||
<a href="/pkg/go/build/#hdr-Build_Constraints">build tag</a> <code>race</code>.
|
||||
You can use the tag to exclude some code and tests when running the race detector.
|
||||
Some examples:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
// +build !race
|
||||
|
||||
package foo
|
||||
|
||||
// The test contains a data race. See issue 123.
|
||||
func TestFoo(t *testing.T) {
|
||||
// ...
|
||||
}
|
||||
|
||||
// The test fails under the race detector due to timeouts.
|
||||
func TestBar(t *testing.T) {
|
||||
// ...
|
||||
}
|
||||
|
||||
// The test takes too long under the race detector.
|
||||
func TestBaz(t *testing.T) {
|
||||
// ...
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h2 id="How_To_Use">How To Use</h2>
|
||||
|
||||
<p>
|
||||
To start, run your tests using the race detector (<code>go test -race</code>).
|
||||
The race detector only finds races that happen at runtime, so it can't find
|
||||
races in code paths that are not executed.
|
||||
If your tests have incomplete coverage,
|
||||
you may find more races by running a binary built with <code>-race</code> under a realistic
|
||||
workload.
|
||||
</p>
|
||||
|
||||
<h2 id="Typical_Data_Races">Typical Data Races</h2>
|
||||
|
||||
<p>
|
||||
Here are some typical data races. All of them can be detected with the race detector.
|
||||
</p>
|
||||
|
||||
<h3 id="Race_on_loop_counter">Race on loop counter</h3>
|
||||
|
||||
<pre>
|
||||
func main() {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(5)
|
||||
for i := 0; i < 5; i++ {
|
||||
go func() {
|
||||
fmt.Println(i) // Not the 'i' you are looking for.
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The variable <code>i</code> in the function literal is the same variable used by the loop, so
|
||||
the read in the goroutine races with the loop increment.
|
||||
(This program typically prints 55555, not 01234.)
|
||||
The program can be fixed by making a copy of the variable:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
func main() {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(5)
|
||||
for i := 0; i < 5; i++ {
|
||||
go func(j int) {
|
||||
fmt.Println(j) // Good. Read local copy of the loop counter.
|
||||
wg.Done()
|
||||
}(i)
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3 id="Accidentally_shared_variable">Accidentally shared variable</h3>
|
||||
|
||||
<pre>
|
||||
// ParallelWrite writes data to file1 and file2, returns the errors.
|
||||
func ParallelWrite(data []byte) chan error {
|
||||
res := make(chan error, 2)
|
||||
f1, err := os.Create("file1")
|
||||
if err != nil {
|
||||
res <- err
|
||||
} else {
|
||||
go func() {
|
||||
// This err is shared with the main goroutine,
|
||||
// so the write races with the write below.
|
||||
_, err = f1.Write(data)
|
||||
res <- err
|
||||
f1.Close()
|
||||
}()
|
||||
}
|
||||
f2, err := os.Create("file2") // The second conflicting write to err.
|
||||
if err != nil {
|
||||
res <- err
|
||||
} else {
|
||||
go func() {
|
||||
_, err = f2.Write(data)
|
||||
res <- err
|
||||
f2.Close()
|
||||
}()
|
||||
}
|
||||
return res
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The fix is to introduce new variables in the goroutines (note the use of <code>:=</code>):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
_, err := f1.Write(data)
|
||||
...
|
||||
_, err := f2.Write(data)
|
||||
...
|
||||
</pre>
|
||||
|
||||
<h3 id="Unprotected_global_variable">Unprotected global variable</h3>
|
||||
|
||||
<p>
|
||||
If the following code is called from several goroutines, it leads to races on the <code>service</code> map.
|
||||
Concurrent reads and writes of the same map are not safe:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
var service map[string]net.Addr
|
||||
|
||||
func RegisterService(name string, addr net.Addr) {
|
||||
service[name] = addr
|
||||
}
|
||||
|
||||
func LookupService(name string) net.Addr {
|
||||
return service[name]
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
To make the code safe, protect the accesses with a mutex:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
var (
|
||||
service map[string]net.Addr
|
||||
serviceMu sync.Mutex
|
||||
)
|
||||
|
||||
func RegisterService(name string, addr net.Addr) {
|
||||
serviceMu.Lock()
|
||||
defer serviceMu.Unlock()
|
||||
service[name] = addr
|
||||
}
|
||||
|
||||
func LookupService(name string) net.Addr {
|
||||
serviceMu.Lock()
|
||||
defer serviceMu.Unlock()
|
||||
return service[name]
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3 id="Primitive_unprotected_variable">Primitive unprotected variable</h3>
|
||||
|
||||
<p>
|
||||
Data races can happen on variables of primitive types as well (<code>bool</code>, <code>int</code>, <code>int64</code>, etc.),
|
||||
as in this example:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
type Watchdog struct{ last int64 }
|
||||
|
||||
func (w *Watchdog) KeepAlive() {
|
||||
w.last = time.Now().UnixNano() // First conflicting access.
|
||||
}
|
||||
|
||||
func (w *Watchdog) Start() {
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(time.Second)
|
||||
// Second conflicting access.
|
||||
if w.last < time.Now().Add(-10*time.Second).UnixNano() {
|
||||
fmt.Println("No keepalives for 10 seconds. Dying.")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Even such "innocent" data races can lead to hard-to-debug problems caused by
|
||||
non-atomicity of the memory accesses,
|
||||
interference with compiler optimizations,
|
||||
or reordering issues accessing processor memory .
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A typical fix for this race is to use a channel or a mutex.
|
||||
To preserve the lock-free behavior, one can also use the
|
||||
<a href="/pkg/sync/atomic/"><code>sync/atomic</code></a> package.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
type Watchdog struct{ last int64 }
|
||||
|
||||
func (w *Watchdog) KeepAlive() {
|
||||
atomic.StoreInt64(&w.last, time.Now().UnixNano())
|
||||
}
|
||||
|
||||
func (w *Watchdog) Start() {
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(time.Second)
|
||||
if atomic.LoadInt64(&w.last) < time.Now().Add(-10*time.Second).UnixNano() {
|
||||
fmt.Println("No keepalives for 10 seconds. Dying.")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h2 id="Supported_Systems">Supported Systems</h2>
|
||||
|
||||
<p>
|
||||
The race detector runs on <code>darwin/amd64</code>, <code>freebsd/amd64</code>,
|
||||
<code>linux/amd64</code>, and <code>windows/amd64</code>.
|
||||
</p>
|
||||
|
||||
<h2 id="Runtime_Overheads">Runtime Overhead</h2>
|
||||
|
||||
<p>
|
||||
The cost of race detection varies by program, but for a typical program, memory
|
||||
usage may increase by 5-10x and execution time by 2-20x.
|
||||
</p>
|
||||
@@ -1,6 +0,0 @@
|
||||
<h1>Editing {{.Title}}</h1>
|
||||
|
||||
<form action="/save/{{.Title}}" method="POST">
|
||||
<div><textarea name="body" rows="20" cols="80">{{printf "%s" .Body}}</textarea></div>
|
||||
<div><input type="submit" value="Save"></div>
|
||||
</form>
|
||||
@@ -1,102 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title, err := getTitle(w, r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/edit/"+title, http.StatusFound)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title, err := getTitle(w, r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title, err := getTitle(w, r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
err = p.save()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
t, err := template.ParseFiles(tmpl + ".html")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
err = t.Execute(w, p)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
|
||||
|
||||
func getTitle(w http.ResponseWriter, r *http.Request) (string, error) {
|
||||
m := validPath.FindStringSubmatch(r.URL.Path)
|
||||
if m == nil {
|
||||
http.NotFound(w, r)
|
||||
return "", errors.New("Invalid Page Title")
|
||||
}
|
||||
return m[2], nil // The title is the second subexpression.
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.HandleFunc("/edit/", editHandler)
|
||||
http.HandleFunc("/save/", saveHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/edit/"):]
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
t, _ := template.ParseFiles("edit.html")
|
||||
t.Execute(w, p)
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/view/"):]
|
||||
p, _ := loadPage(title)
|
||||
t, _ := template.ParseFiles("view.html")
|
||||
t.Execute(w, p)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.HandleFunc("/edit/", editHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/edit/"+title, http.StatusFound)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
err := p.save()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
t, err := template.ParseFiles(tmpl + ".html")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
err = t.Execute(w, p)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
|
||||
|
||||
func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
m := validPath.FindStringSubmatch(r.URL.Path)
|
||||
if m == nil {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
fn(w, r, m[2])
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", makeHandler(viewHandler))
|
||||
http.HandleFunc("/edit/", makeHandler(editHandler))
|
||||
http.HandleFunc("/save/", makeHandler(saveHandler))
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/edit/"):]
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/view/"):]
|
||||
p, _ := loadPage(title)
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/save/"):]
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
p.save()
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
t, _ := template.ParseFiles(tmpl + ".html")
|
||||
t.Execute(w, p)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.HandleFunc("/edit/", editHandler)
|
||||
http.HandleFunc("/save/", saveHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
*** final.go 2015-06-14 23:59:22.000000000 +0200
|
||||
--- final-test.go 2015-06-15 00:15:41.000000000 +0200
|
||||
***************
|
||||
*** 7,12 ****
|
||||
--- 7,14 ----
|
||||
import (
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
+ "log"
|
||||
+ "net"
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
***************
|
||||
*** 85,89 ****
|
||||
http.HandleFunc("/edit/", makeHandler(editHandler))
|
||||
http.HandleFunc("/save/", makeHandler(saveHandler))
|
||||
|
||||
! http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
--- 87,101 ----
|
||||
http.HandleFunc("/edit/", makeHandler(editHandler))
|
||||
http.HandleFunc("/save/", makeHandler(saveHandler))
|
||||
|
||||
! l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
! if err != nil {
|
||||
! log.Fatal(err)
|
||||
! }
|
||||
! err = ioutil.WriteFile("final-test-port.txt", []byte(l.Addr().String()), 0644)
|
||||
! if err != nil {
|
||||
! log.Fatal(err)
|
||||
! }
|
||||
! s := &http.Server{}
|
||||
! s.Serve(l)
|
||||
! return
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/edit/"+title, http.StatusFound)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
err := p.save()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
err := templates.ExecuteTemplate(w, tmpl+".html", p)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
|
||||
|
||||
func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
m := validPath.FindStringSubmatch(r.URL.Path)
|
||||
if m == nil {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
fn(w, r, m[2])
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", makeHandler(viewHandler))
|
||||
http.HandleFunc("/edit/", makeHandler(editHandler))
|
||||
http.HandleFunc("/save/", makeHandler(saveHandler))
|
||||
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
post = flag.String("post", "", "urlencoded form data to POST")
|
||||
addr = flag.Bool("addr", false, "find open address and print to stdout")
|
||||
wait = flag.Duration("wait_for_port", 0, "if non-zero, the amount of time to wait for the address to become available")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if *addr {
|
||||
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer l.Close()
|
||||
fmt.Print(l.Addr())
|
||||
return
|
||||
}
|
||||
url := flag.Arg(0)
|
||||
if url == "" {
|
||||
log.Fatal("no url supplied")
|
||||
}
|
||||
var r *http.Response
|
||||
var err error
|
||||
loopUntil := time.Now().Add(*wait)
|
||||
for {
|
||||
if *post != "" {
|
||||
b := strings.NewReader(*post)
|
||||
r, err = http.Post(url, "application/x-www-form-urlencoded", b)
|
||||
} else {
|
||||
r, err = http.Get(url)
|
||||
}
|
||||
if err == nil || *wait == 0 || time.Now().After(loopUntil) {
|
||||
break
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer r.Body.Close()
|
||||
_, err = io.Copy(os.Stdout, r.Body)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
@@ -1,734 +0,0 @@
|
||||
<!--{
|
||||
"Title": "Writing Web Applications",
|
||||
"Template": true
|
||||
}-->
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
<p>
|
||||
Covered in this tutorial:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Creating a data structure with load and save methods</li>
|
||||
<li>Using the <code>net/http</code> package to build web applications
|
||||
<li>Using the <code>html/template</code> package to process HTML templates</li>
|
||||
<li>Using the <code>regexp</code> package to validate user input</li>
|
||||
<li>Using closures</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Assumed knowledge:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Programming experience</li>
|
||||
<li>Understanding of basic web technologies (HTTP, HTML)</li>
|
||||
<li>Some UNIX/DOS command-line knowledge</li>
|
||||
</ul>
|
||||
|
||||
<h2>Getting Started</h2>
|
||||
|
||||
<p>
|
||||
At present, you need to have a FreeBSD, Linux, OS X, or Windows machine to run Go.
|
||||
We will use <code>$</code> to represent the command prompt.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Install Go (see the <a href="/doc/install">Installation Instructions</a>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Make a new directory for this tutorial inside your <code>GOPATH</code> and cd to it:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ mkdir gowiki
|
||||
$ cd gowiki
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Create a file named <code>wiki.go</code>, open it in your favorite editor, and
|
||||
add the following lines:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
We import the <code>fmt</code> and <code>ioutil</code> packages from the Go
|
||||
standard library. Later, as we implement additional functionality, we will
|
||||
add more packages to this <code>import</code> declaration.
|
||||
</p>
|
||||
|
||||
<h2>Data Structures</h2>
|
||||
|
||||
<p>
|
||||
Let's start by defining the data structures. A wiki consists of a series of
|
||||
interconnected pages, each of which has a title and a body (the page content).
|
||||
Here, we define <code>Page</code> as a struct with two fields representing
|
||||
the title and body.
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part1.go" `/^type Page/` `/}/`}}
|
||||
|
||||
<p>
|
||||
The type <code>[]byte</code> means "a <code>byte</code> slice".
|
||||
(See <a href="/doc/articles/slices_usage_and_internals.html">Slices: usage and
|
||||
internals</a> for more on slices.)
|
||||
The <code>Body</code> element is a <code>[]byte</code> rather than
|
||||
<code>string</code> because that is the type expected by the <code>io</code>
|
||||
libraries we will use, as you'll see below.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>Page</code> struct describes how page data will be stored in memory.
|
||||
But what about persistent storage? We can address that by creating a
|
||||
<code>save</code> method on <code>Page</code>:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part1.go" `/^func.*Page.*save/` `/}/`}}
|
||||
|
||||
<p>
|
||||
This method's signature reads: "This is a method named <code>save</code> that
|
||||
takes as its receiver <code>p</code>, a pointer to <code>Page</code> . It takes
|
||||
no parameters, and returns a value of type <code>error</code>."
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This method will save the <code>Page</code>'s <code>Body</code> to a text
|
||||
file. For simplicity, we will use the <code>Title</code> as the file name.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>save</code> method returns an <code>error</code> value because
|
||||
that is the return type of <code>WriteFile</code> (a standard library function
|
||||
that writes a byte slice to a file). The <code>save</code> method returns the
|
||||
error value, to let the application handle it should anything go wrong while
|
||||
writing the file. If all goes well, <code>Page.save()</code> will return
|
||||
<code>nil</code> (the zero-value for pointers, interfaces, and some other
|
||||
types).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The octal integer literal <code>0600</code>, passed as the third parameter to
|
||||
<code>WriteFile</code>, indicates that the file should be created with
|
||||
read-write permissions for the current user only. (See the Unix man page
|
||||
<code>open(2)</code> for details.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In addition to saving pages, we will want to load pages, too:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part1-noerror.go" `/^func loadPage/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
The function <code>loadPage</code> constructs the file name from the title
|
||||
parameter, reads the file's contents into a new variable <code>body</code>, and
|
||||
returns a pointer to a <code>Page</code> literal constructed with the proper
|
||||
title and body values.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Functions can return multiple values. The standard library function
|
||||
<code>io.ReadFile</code> returns <code>[]byte</code> and <code>error</code>.
|
||||
In <code>loadPage</code>, error isn't being handled yet; the "blank identifier"
|
||||
represented by the underscore (<code>_</code>) symbol is used to throw away the
|
||||
error return value (in essence, assigning the value to nothing).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
But what happens if <code>ReadFile</code> encounters an error? For example,
|
||||
the file might not exist. We should not ignore such errors. Let's modify the
|
||||
function to return <code>*Page</code> and <code>error</code>.
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part1.go" `/^func loadPage/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
Callers of this function can now check the second parameter; if it is
|
||||
<code>nil</code> then it has successfully loaded a Page. If not, it will be an
|
||||
<code>error</code> that can be handled by the caller (see the
|
||||
<a href="/ref/spec#Errors">language specification</a> for details).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
At this point we have a simple data structure and the ability to save to and
|
||||
load from a file. Let's write a <code>main</code> function to test what we've
|
||||
written:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part1.go" `/^func main/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
After compiling and executing this code, a file named <code>TestPage.txt</code>
|
||||
would be created, containing the contents of <code>p1</code>. The file would
|
||||
then be read into the struct <code>p2</code>, and its <code>Body</code> element
|
||||
printed to the screen.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can compile and run the program like this:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ go build wiki.go
|
||||
$ ./wiki
|
||||
This is a sample page.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
(If you're using Windows you must type "<code>wiki</code>" without the
|
||||
"<code>./</code>" to run the program.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="part1.go">Click here to view the code we've written so far.</a>
|
||||
</p>
|
||||
|
||||
<h2>Introducing the <code>net/http</code> package (an interlude)</h2>
|
||||
|
||||
<p>
|
||||
Here's a full working example of a simple web server:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/http-sample.go"}}
|
||||
|
||||
<p>
|
||||
The <code>main</code> function begins with a call to
|
||||
<code>http.HandleFunc</code>, which tells the <code>http</code> package to
|
||||
handle all requests to the web root (<code>"/"</code>) with
|
||||
<code>handler</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It then calls <code>http.ListenAndServe</code>, specifying that it should
|
||||
listen on port 8080 on any interface (<code>":8080"</code>). (Don't
|
||||
worry about its second parameter, <code>nil</code>, for now.)
|
||||
This function will block until the program is terminated.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The function <code>handler</code> is of the type <code>http.HandlerFunc</code>.
|
||||
It takes an <code>http.ResponseWriter</code> and an <code>http.Request</code> as
|
||||
its arguments.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
An <code>http.ResponseWriter</code> value assembles the HTTP server's response; by writing
|
||||
to it, we send data to the HTTP client.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
An <code>http.Request</code> is a data structure that represents the client
|
||||
HTTP request. <code>r.URL.Path</code> is the path component
|
||||
of the request URL. The trailing <code>[1:]</code> means
|
||||
"create a sub-slice of <code>Path</code> from the 1st character to the end."
|
||||
This drops the leading "/" from the path name.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you run this program and access the URL:
|
||||
</p>
|
||||
<pre>http://localhost:8080/monkeys</pre>
|
||||
<p>
|
||||
the program would present a page containing:
|
||||
</p>
|
||||
<pre>Hi there, I love monkeys!</pre>
|
||||
|
||||
<h2>Using <code>net/http</code> to serve wiki pages</h2>
|
||||
|
||||
<p>
|
||||
To use the <code>net/http</code> package, it must be imported:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
<b>"net/http"</b>
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Let's create a handler, <code>viewHandler</code> that will allow users to
|
||||
view a wiki page. It will handle URLs prefixed with "/view/".
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part2.go" `/^func viewHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
First, this function extracts the page title from <code>r.URL.Path</code>,
|
||||
the path component of the request URL.
|
||||
The <code>Path</code> is re-sliced with <code>[len("/view/"):]</code> to drop
|
||||
the leading <code>"/view/"</code> component of the request path.
|
||||
This is because the path will invariably begin with <code>"/view/"</code>,
|
||||
which is not part of the page's title.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The function then loads the page data, formats the page with a string of simple
|
||||
HTML, and writes it to <code>w</code>, the <code>http.ResponseWriter</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Again, note the use of <code>_</code> to ignore the <code>error</code>
|
||||
return value from <code>loadPage</code>. This is done here for simplicity
|
||||
and generally considered bad practice. We will attend to this later.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To use this handler, we rewrite our <code>main</code> function to
|
||||
initialize <code>http</code> using the <code>viewHandler</code> to handle
|
||||
any requests under the path <code>/view/</code>.
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part2.go" `/^func main/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
<a href="part2.go">Click here to view the code we've written so far.</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Let's create some page data (as <code>test.txt</code>), compile our code, and
|
||||
try serving a wiki page.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Open <code>test.txt</code> file in your editor, and save the string "Hello world" (without quotes)
|
||||
in it.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ go build wiki.go
|
||||
$ ./wiki
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
(If you're using Windows you must type "<code>wiki</code>" without the
|
||||
"<code>./</code>" to run the program.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
With this web server running, a visit to <code><a
|
||||
href="http://localhost:8080/view/test">http://localhost:8080/view/test</a></code>
|
||||
should show a page titled "test" containing the words "Hello world".
|
||||
</p>
|
||||
|
||||
<h2>Editing Pages</h2>
|
||||
|
||||
<p>
|
||||
A wiki is not a wiki without the ability to edit pages. Let's create two new
|
||||
handlers: one named <code>editHandler</code> to display an 'edit page' form,
|
||||
and the other named <code>saveHandler</code> to save the data entered via the
|
||||
form.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, we add them to <code>main()</code>:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-noclosure.go" `/^func main/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
The function <code>editHandler</code> loads the page
|
||||
(or, if it doesn't exist, create an empty <code>Page</code> struct),
|
||||
and displays an HTML form.
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/notemplate.go" `/^func editHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
This function will work fine, but all that hard-coded HTML is ugly.
|
||||
Of course, there is a better way.
|
||||
</p>
|
||||
|
||||
<h2>The <code>html/template</code> package</h2>
|
||||
|
||||
<p>
|
||||
The <code>html/template</code> package is part of the Go standard library.
|
||||
We can use <code>html/template</code> to keep the HTML in a separate file,
|
||||
allowing us to change the layout of our edit page without modifying the
|
||||
underlying Go code.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, we must add <code>html/template</code> to the list of imports. We
|
||||
also won't be using <code>fmt</code> anymore, so we have to remove that.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
import (
|
||||
<b>"html/template"</b>
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Let's create a template file containing the HTML form.
|
||||
Open a new file named <code>edit.html</code>, and add the following lines:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/edit.html"}}
|
||||
|
||||
<p>
|
||||
Modify <code>editHandler</code> to use the template, instead of the hard-coded
|
||||
HTML:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-noerror.go" `/^func editHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
The function <code>template.ParseFiles</code> will read the contents of
|
||||
<code>edit.html</code> and return a <code>*template.Template</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The method <code>t.Execute</code> executes the template, writing the
|
||||
generated HTML to the <code>http.ResponseWriter</code>.
|
||||
The <code>.Title</code> and <code>.Body</code> dotted identifiers refer to
|
||||
<code>p.Title</code> and <code>p.Body</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Template directives are enclosed in double curly braces.
|
||||
The <code>printf "%s" .Body</code> instruction is a function call
|
||||
that outputs <code>.Body</code> as a string instead of a stream of bytes,
|
||||
the same as a call to <code>fmt.Printf</code>.
|
||||
The <code>html/template</code> package helps guarantee that only safe and
|
||||
correct-looking HTML is generated by template actions. For instance, it
|
||||
automatically escapes any greater than sign (<code>></code>), replacing it
|
||||
with <code>&gt;</code>, to make sure user data does not corrupt the form
|
||||
HTML.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Since we're working with templates now, let's create a template for our
|
||||
<code>viewHandler</code> called <code>view.html</code>:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/view.html"}}
|
||||
|
||||
<p>
|
||||
Modify <code>viewHandler</code> accordingly:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-noerror.go" `/^func viewHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
Notice that we've used almost exactly the same templating code in both
|
||||
handlers. Let's remove this duplication by moving the templating code
|
||||
to its own function:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-template.go" `/^func renderTemplate/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
And modify the handlers to use that function:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-template.go" `/^func viewHandler/` `/^}/`}}
|
||||
{{code "doc/articles/wiki/final-template.go" `/^func editHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
If we comment out the registration of our unimplemented save handler in
|
||||
<code>main</code>, we can once again build and test our program.
|
||||
<a href="part3.go">Click here to view the code we've written so far.</a>
|
||||
</p>
|
||||
|
||||
<h2>Handling non-existent pages</h2>
|
||||
|
||||
<p>
|
||||
What if you visit <a href="http://localhost:8080/view/APageThatDoesntExist">
|
||||
<code>/view/APageThatDoesntExist</code></a>? You'll see a page containing
|
||||
HTML. This is because it ignores the error return value from
|
||||
<code>loadPage</code> and continues to try and fill out the template
|
||||
with no data. Instead, if the requested Page doesn't exist, it should
|
||||
redirect the client to the edit Page so the content may be created:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part3-errorhandling.go" `/^func viewHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
The <code>http.Redirect</code> function adds an HTTP status code of
|
||||
<code>http.StatusFound</code> (302) and a <code>Location</code>
|
||||
header to the HTTP response.
|
||||
</p>
|
||||
|
||||
<h2>Saving Pages</h2>
|
||||
|
||||
<p>
|
||||
The function <code>saveHandler</code> will handle the submission of forms
|
||||
located on the edit pages. After uncommenting the related line in
|
||||
<code>main</code>, let's implement the handler:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-template.go" `/^func saveHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
The page title (provided in the URL) and the form's only field,
|
||||
<code>Body</code>, are stored in a new <code>Page</code>.
|
||||
The <code>save()</code> method is then called to write the data to a file,
|
||||
and the client is redirected to the <code>/view/</code> page.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The value returned by <code>FormValue</code> is of type <code>string</code>.
|
||||
We must convert that value to <code>[]byte</code> before it will fit into
|
||||
the <code>Page</code> struct. We use <code>[]byte(body)</code> to perform
|
||||
the conversion.
|
||||
</p>
|
||||
|
||||
<h2>Error handling</h2>
|
||||
|
||||
<p>
|
||||
There are several places in our program where errors are being ignored. This
|
||||
is bad practice, not least because when an error does occur the program will
|
||||
have unintended behavior. A better solution is to handle the errors and return
|
||||
an error message to the user. That way if something does go wrong, the server
|
||||
will function exactly how we want and the user can be notified.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, let's handle the errors in <code>renderTemplate</code>:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-parsetemplate.go" `/^func renderTemplate/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
The <code>http.Error</code> function sends a specified HTTP response code
|
||||
(in this case "Internal Server Error") and error message.
|
||||
Already the decision to put this in a separate function is paying off.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now let's fix up <code>saveHandler</code>:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/part3-errorhandling.go" `/^func saveHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
Any errors that occur during <code>p.save()</code> will be reported
|
||||
to the user.
|
||||
</p>
|
||||
|
||||
<h2>Template caching</h2>
|
||||
|
||||
<p>
|
||||
There is an inefficiency in this code: <code>renderTemplate</code> calls
|
||||
<code>ParseFiles</code> every time a page is rendered.
|
||||
A better approach would be to call <code>ParseFiles</code> once at program
|
||||
initialization, parsing all templates into a single <code>*Template</code>.
|
||||
Then we can use the
|
||||
<a href="/pkg/html/template/#Template.ExecuteTemplate"><code>ExecuteTemplate</code></a>
|
||||
method to render a specific template.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First we create a global variable named <code>templates</code>, and initialize
|
||||
it with <code>ParseFiles</code>.
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final.go" `/var templates/`}}
|
||||
|
||||
<p>
|
||||
The function <code>template.Must</code> is a convenience wrapper that panics
|
||||
when passed a non-nil <code>error</code> value, and otherwise returns the
|
||||
<code>*Template</code> unaltered. A panic is appropriate here; if the templates
|
||||
can't be loaded the only sensible thing to do is exit the program.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>ParseFiles</code> function takes any number of string arguments that
|
||||
identify our template files, and parses those files into templates that are
|
||||
named after the base file name. If we were to add more templates to our
|
||||
program, we would add their names to the <code>ParseFiles</code> call's
|
||||
arguments.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We then modify the <code>renderTemplate</code> function to call the
|
||||
<code>templates.ExecuteTemplate</code> method with the name of the appropriate
|
||||
template:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final.go" `/func renderTemplate/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
Note that the template name is the template file name, so we must
|
||||
append <code>".html"</code> to the <code>tmpl</code> argument.
|
||||
</p>
|
||||
|
||||
<h2>Validation</h2>
|
||||
|
||||
<p>
|
||||
As you may have observed, this program has a serious security flaw: a user
|
||||
can supply an arbitrary path to be read/written on the server. To mitigate
|
||||
this, we can write a function to validate the title with a regular expression.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, add <code>"regexp"</code> to the <code>import</code> list.
|
||||
Then we can create a global variable to store our validation
|
||||
expression:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-noclosure.go" `/^var validPath/`}}
|
||||
|
||||
<p>
|
||||
The function <code>regexp.MustCompile</code> will parse and compile the
|
||||
regular expression, and return a <code>regexp.Regexp</code>.
|
||||
<code>MustCompile</code> is distinct from <code>Compile</code> in that it will
|
||||
panic if the expression compilation fails, while <code>Compile</code> returns
|
||||
an <code>error</code> as a second parameter.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now, let's write a function that uses the <code>validPath</code>
|
||||
expression to validate path and extract the page title:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-noclosure.go" `/func getTitle/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
If the title is valid, it will be returned along with a <code>nil</code>
|
||||
error value. If the title is invalid, the function will write a
|
||||
"404 Not Found" error to the HTTP connection, and return an error to the
|
||||
handler. To create a new error, we have to import the <code>errors</code>
|
||||
package.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Let's put a call to <code>getTitle</code> in each of the handlers:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final-noclosure.go" `/^func viewHandler/` `/^}/`}}
|
||||
{{code "doc/articles/wiki/final-noclosure.go" `/^func editHandler/` `/^}/`}}
|
||||
{{code "doc/articles/wiki/final-noclosure.go" `/^func saveHandler/` `/^}/`}}
|
||||
|
||||
<h2>Introducing Function Literals and Closures</h2>
|
||||
|
||||
<p>
|
||||
Catching the error condition in each handler introduces a lot of repeated code.
|
||||
What if we could wrap each of the handlers in a function that does this
|
||||
validation and error checking? Go's
|
||||
<a href="/ref/spec#Function_literals">function
|
||||
literals</a> provide a powerful means of abstracting functionality
|
||||
that can help us here.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, we re-write the function definition of each of the handlers to accept
|
||||
a title string:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request, title string)
|
||||
func editHandler(w http.ResponseWriter, r *http.Request, title string)
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request, title string)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Now let's define a wrapper function that <i>takes a function of the above
|
||||
type</i>, and returns a function of type <code>http.HandlerFunc</code>
|
||||
(suitable to be passed to the function <code>http.HandleFunc</code>):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
func makeHandler(fn func (http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
// Here we will extract the page title from the Request,
|
||||
// and call the provided handler 'fn'
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The returned function is called a closure because it encloses values defined
|
||||
outside of it. In this case, the variable <code>fn</code> (the single argument
|
||||
to <code>makeHandler</code>) is enclosed by the closure. The variable
|
||||
<code>fn</code> will be one of our save, edit, or view handlers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now we can take the code from <code>getTitle</code> and use it here
|
||||
(with some minor modifications):
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final.go" `/func makeHandler/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
The closure returned by <code>makeHandler</code> is a function that takes
|
||||
an <code>http.ResponseWriter</code> and <code>http.Request</code> (in other
|
||||
words, an <code>http.HandlerFunc</code>).
|
||||
The closure extracts the <code>title</code> from the request path, and
|
||||
validates it with the <code>TitleValidator</code> regexp. If the
|
||||
<code>title</code> is invalid, an error will be written to the
|
||||
<code>ResponseWriter</code> using the <code>http.NotFound</code> function.
|
||||
If the <code>title</code> is valid, the enclosed handler function
|
||||
<code>fn</code> will be called with the <code>ResponseWriter</code>,
|
||||
<code>Request</code>, and <code>title</code> as arguments.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now we can wrap the handler functions with <code>makeHandler</code> in
|
||||
<code>main</code>, before they are registered with the <code>http</code>
|
||||
package:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final.go" `/func main/` `/^}/`}}
|
||||
|
||||
<p>
|
||||
Finally we remove the calls to <code>getTitle</code> from the handler functions,
|
||||
making them much simpler:
|
||||
</p>
|
||||
|
||||
{{code "doc/articles/wiki/final.go" `/^func viewHandler/` `/^}/`}}
|
||||
{{code "doc/articles/wiki/final.go" `/^func editHandler/` `/^}/`}}
|
||||
{{code "doc/articles/wiki/final.go" `/^func saveHandler/` `/^}/`}}
|
||||
|
||||
<h2>Try it out!</h2>
|
||||
|
||||
<p>
|
||||
<a href="final.go">Click here to view the final code listing.</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Recompile the code, and run the app:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ go build wiki.go
|
||||
$ ./wiki
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Visiting <a href="http://localhost:8080/view/ANewPage">http://localhost:8080/view/ANewPage</a>
|
||||
should present you with the page edit form. You should then be able to
|
||||
enter some text, click 'Save', and be redirected to the newly created page.
|
||||
</p>
|
||||
|
||||
<h2>Other tasks</h2>
|
||||
|
||||
<p>
|
||||
Here are some simple tasks you might want to tackle on your own:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Store templates in <code>tmpl/</code> and page data in <code>data/</code>.
|
||||
<li>Add a handler to make the web root redirect to
|
||||
<code>/view/FrontPage</code>.</li>
|
||||
<li>Spruce up the page templates by making them valid HTML and adding some
|
||||
CSS rules.</li>
|
||||
<li>Implement inter-page linking by converting instances of
|
||||
<code>[PageName]</code> to <br>
|
||||
<code><a href="/view/PageName">PageName</a></code>.
|
||||
(hint: you could use <code>regexp.ReplaceAllFunc</code> to do this)
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) *Page {
|
||||
filename := title + ".txt"
|
||||
body, _ := ioutil.ReadFile(filename)
|
||||
return &Page{Title: title, Body: body}
|
||||
}
|
||||
|
||||
func main() {
|
||||
p1 := &Page{Title: "TestPage", Body: []byte("This is a sample page.")}
|
||||
p1.save()
|
||||
p2 := loadPage("TestPage")
|
||||
fmt.Println(string(p2.Body))
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
p1 := &Page{Title: "TestPage", Body: []byte("This is a sample Page.")}
|
||||
p1.save()
|
||||
p2, _ := loadPage("TestPage")
|
||||
fmt.Println(string(p2.Body))
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/view/"):]
|
||||
p, _ := loadPage(title)
|
||||
fmt.Fprintf(w, "<h1>%s</h1><div>%s</div>", p.Title, p.Body)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
t, _ := template.ParseFiles(tmpl + ".html")
|
||||
t.Execute(w, p)
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/view/"):]
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/edit/"+title, http.StatusFound)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/edit/"):]
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/save/"):]
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
err := p.save()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.HandleFunc("/edit/", editHandler)
|
||||
http.HandleFunc("/save/", saveHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
t, _ := template.ParseFiles(tmpl + ".html")
|
||||
t.Execute(w, p)
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/view/"):]
|
||||
p, _ := loadPage(title)
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/edit/"):]
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.HandleFunc("/edit/", editHandler)
|
||||
//http.HandleFunc("/save/", saveHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
set -e
|
||||
|
||||
if ! which patch > /dev/null; then
|
||||
echo "Skipping test; patch command not found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
wiki_pid=
|
||||
cleanup() {
|
||||
kill $wiki_pid
|
||||
rm -f test_*.out Test.txt final-test.go final-test.bin final-test-port.txt a.out get.bin
|
||||
}
|
||||
trap cleanup 0 INT
|
||||
|
||||
rm -f get.bin final-test.bin a.out
|
||||
|
||||
# If called with -all, check that all code snippets compile.
|
||||
if [ "$1" == "-all" ]; then
|
||||
for fn in *.go; do
|
||||
go build -o a.out $fn
|
||||
done
|
||||
fi
|
||||
|
||||
go build -o get.bin get.go
|
||||
cp final.go final-test.go
|
||||
patch final-test.go final-test.patch > /dev/null
|
||||
go build -o final-test.bin final-test.go
|
||||
./final-test.bin &
|
||||
wiki_pid=$!
|
||||
|
||||
l=0
|
||||
while [ ! -f ./final-test-port.txt ]
|
||||
do
|
||||
l=$(($l+1))
|
||||
if [ "$l" -gt 5 ]
|
||||
then
|
||||
echo "port not available within 5 seconds"
|
||||
exit 1
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
addr=$(cat final-test-port.txt)
|
||||
./get.bin http://$addr/edit/Test > test_edit.out
|
||||
diff -u test_edit.out test_edit.good
|
||||
./get.bin -post=body=some%20content http://$addr/save/Test > test_save.out
|
||||
diff -u test_save.out test_view.good # should be the same as viewing
|
||||
diff -u Test.txt test_Test.txt.good
|
||||
./get.bin http://$addr/view/Test > test_view.out
|
||||
diff -u test_view.out test_view.good
|
||||
|
||||
echo PASS
|
||||
@@ -1,5 +0,0 @@
|
||||
<h1>{{.Title}}</h1>
|
||||
|
||||
<p>[<a href="/edit/{{.Title}}">edit</a>]</p>
|
||||
|
||||
<div>{{printf "%s" .Body}}</div>
|
||||
910
doc/asm.html
910
doc/asm.html
@@ -1,910 +0,0 @@
|
||||
<!--{
|
||||
"Title": "A Quick Guide to Go's Assembler",
|
||||
"Path": "/doc/asm"
|
||||
}-->
|
||||
|
||||
<h2 id="introduction">A Quick Guide to Go's Assembler</h2>
|
||||
|
||||
<p>
|
||||
This document is a quick outline of the unusual form of assembly language used by the <code>gc</code> Go compiler.
|
||||
The document is not comprehensive.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The assembler is based on the input style of the Plan 9 assemblers, which is documented in detail
|
||||
<a href="https://9p.io/sys/doc/asm.html">elsewhere</a>.
|
||||
If you plan to write assembly language, you should read that document although much of it is Plan 9-specific.
|
||||
The current document provides a summary of the syntax and the differences with
|
||||
what is explained in that document, and
|
||||
describes the peculiarities that apply when writing assembly code to interact with Go.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The most important thing to know about Go's assembler is that it is not a direct representation of the underlying machine.
|
||||
Some of the details map precisely to the machine, but some do not.
|
||||
This is because the compiler suite (see
|
||||
<a href="https://9p.io/sys/doc/compiler.html">this description</a>)
|
||||
needs no assembler pass in the usual pipeline.
|
||||
Instead, the compiler operates on a kind of semi-abstract instruction set,
|
||||
and instruction selection occurs partly after code generation.
|
||||
The assembler works on the semi-abstract form, so
|
||||
when you see an instruction like <code>MOV</code>
|
||||
what the tool chain actually generates for that operation might
|
||||
not be a move instruction at all, perhaps a clear or load.
|
||||
Or it might correspond exactly to the machine instruction with that name.
|
||||
In general, machine-specific operations tend to appear as themselves, while more general concepts like
|
||||
memory move and subroutine call and return are more abstract.
|
||||
The details vary with architecture, and we apologize for the imprecision; the situation is not well-defined.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The assembler program is a way to parse a description of that
|
||||
semi-abstract instruction set and turn it into instructions to be
|
||||
input to the linker.
|
||||
If you want to see what the instructions look like in assembly for a given architecture, say amd64, there
|
||||
are many examples in the sources of the standard library, in packages such as
|
||||
<a href="/pkg/runtime/"><code>runtime</code></a> and
|
||||
<a href="/pkg/math/big/"><code>math/big</code></a>.
|
||||
You can also examine what the compiler emits as assembly code
|
||||
(the actual output may differ from what you see here):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ cat x.go
|
||||
package main
|
||||
|
||||
func main() {
|
||||
println(3)
|
||||
}
|
||||
$ GOOS=linux GOARCH=amd64 go tool compile -S x.go # or: go build -gcflags -S x.go
|
||||
|
||||
--- prog list "main" ---
|
||||
0000 (x.go:3) TEXT main+0(SB),$8-0
|
||||
0001 (x.go:3) FUNCDATA $0,gcargs·0+0(SB)
|
||||
0002 (x.go:3) FUNCDATA $1,gclocals·0+0(SB)
|
||||
0003 (x.go:4) MOVQ $3,(SP)
|
||||
0004 (x.go:4) PCDATA $0,$8
|
||||
0005 (x.go:4) CALL ,runtime.printint+0(SB)
|
||||
0006 (x.go:4) PCDATA $0,$-1
|
||||
0007 (x.go:4) PCDATA $0,$0
|
||||
0008 (x.go:4) CALL ,runtime.printnl+0(SB)
|
||||
0009 (x.go:4) PCDATA $0,$-1
|
||||
0010 (x.go:5) RET ,
|
||||
...
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The <code>FUNCDATA</code> and <code>PCDATA</code> directives contain information
|
||||
for use by the garbage collector; they are introduced by the compiler.
|
||||
</p>
|
||||
|
||||
<!-- Commenting out because the feature is gone but it's popular and may come back.
|
||||
|
||||
<p>
|
||||
To see what gets put in the binary after linking, add the <code>-a</code> flag to the linker:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ go tool 6l -a x.6 # or: go build -ldflags -a x.go
|
||||
codeblk [0x2000,0x1d059) at offset 0x1000
|
||||
002000 main.main | (3) TEXT main.main+0(SB),$8
|
||||
002000 65488b0c25a0080000 | (3) MOVQ 2208(GS),CX
|
||||
002009 483b21 | (3) CMPQ SP,(CX)
|
||||
00200c 7707 | (3) JHI ,2015
|
||||
00200e e83da20100 | (3) CALL ,1c250+runtime.morestack00
|
||||
002013 ebeb | (3) JMP ,2000
|
||||
002015 4883ec08 | (3) SUBQ $8,SP
|
||||
002019 | (3) FUNCDATA $0,main.gcargs·0+0(SB)
|
||||
002019 | (3) FUNCDATA $1,main.gclocals·0+0(SB)
|
||||
002019 48c7042403000000 | (4) MOVQ $3,(SP)
|
||||
002021 | (4) PCDATA $0,$8
|
||||
002021 e8aad20000 | (4) CALL ,f2d0+runtime.printint
|
||||
002026 | (4) PCDATA $0,$-1
|
||||
002026 | (4) PCDATA $0,$0
|
||||
002026 e865d40000 | (4) CALL ,f490+runtime.printnl
|
||||
00202b | (4) PCDATA $0,$-1
|
||||
00202b 4883c408 | (5) ADDQ $8,SP
|
||||
00202f c3 | (5) RET ,
|
||||
...
|
||||
</pre>
|
||||
|
||||
-->
|
||||
|
||||
<h3 id="constants">Constants</h3>
|
||||
|
||||
<p>
|
||||
Although the assembler takes its guidance from the Plan 9 assemblers,
|
||||
it is a distinct program, so there are some differences.
|
||||
One is in constant evaluation.
|
||||
Constant expressions in the assembler are parsed using Go's operator
|
||||
precedence, not the C-like precedence of the original.
|
||||
Thus <code>3&1<<2</code> is 4, not 0—it parses as <code>(3&1)<<2</code>
|
||||
not <code>3&(1<<2)</code>.
|
||||
Also, constants are always evaluated as 64-bit unsigned integers.
|
||||
Thus <code>-2</code> is not the integer value minus two,
|
||||
but the unsigned 64-bit integer with the same bit pattern.
|
||||
The distinction rarely matters but
|
||||
to avoid ambiguity, division or right shift where the right operand's
|
||||
high bit is set is rejected.
|
||||
</p>
|
||||
|
||||
<h3 id="symbols">Symbols</h3>
|
||||
|
||||
<p>
|
||||
Some symbols, such as <code>R1</code> or <code>LR</code>,
|
||||
are predefined and refer to registers.
|
||||
The exact set depends on the architecture.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There are four predeclared symbols that refer to pseudo-registers.
|
||||
These are not real registers, but rather virtual registers maintained by
|
||||
the tool chain, such as a frame pointer.
|
||||
The set of pseudo-registers is the same for all architectures:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<code>FP</code>: Frame pointer: arguments and locals.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>PC</code>: Program counter:
|
||||
jumps and branches.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>SB</code>: Static base pointer: global symbols.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>SP</code>: Stack pointer: top of stack.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
All user-defined symbols are written as offsets to the pseudo-registers
|
||||
<code>FP</code> (arguments and locals) and <code>SB</code> (globals).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>SB</code> pseudo-register can be thought of as the origin of memory, so the symbol <code>foo(SB)</code>
|
||||
is the name <code>foo</code> as an address in memory.
|
||||
This form is used to name global functions and data.
|
||||
Adding <code><></code> to the name, as in <span style="white-space: nowrap"><code>foo<>(SB)</code></span>, makes the name
|
||||
visible only in the current source file, like a top-level <code>static</code> declaration in a C file.
|
||||
Adding an offset to the name refers to that offset from the symbol's address, so
|
||||
<code>foo+4(SB)</code> is four bytes past the start of <code>foo</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>FP</code> pseudo-register is a virtual frame pointer
|
||||
used to refer to function arguments.
|
||||
The compilers maintain a virtual frame pointer and refer to the arguments on the stack as offsets from that pseudo-register.
|
||||
Thus <code>0(FP)</code> is the first argument to the function,
|
||||
<code>8(FP)</code> is the second (on a 64-bit machine), and so on.
|
||||
However, when referring to a function argument this way, it is necessary to place a name
|
||||
at the beginning, as in <code>first_arg+0(FP)</code> and <code>second_arg+8(FP)</code>.
|
||||
(The meaning of the offset—offset from the frame pointer—distinct
|
||||
from its use with <code>SB</code>, where it is an offset from the symbol.)
|
||||
The assembler enforces this convention, rejecting plain <code>0(FP)</code> and <code>8(FP)</code>.
|
||||
The actual name is semantically irrelevant but should be used to document
|
||||
the argument's name.
|
||||
It is worth stressing that <code>FP</code> is always a
|
||||
pseudo-register, not a hardware
|
||||
register, even on architectures with a hardware frame pointer.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For assembly functions with Go prototypes, <code>go</code> <code>vet</code> will check that the argument names
|
||||
and offsets match.
|
||||
On 32-bit systems, the low and high 32 bits of a 64-bit value are distinguished by adding
|
||||
a <code>_lo</code> or <code>_hi</code> suffix to the name, as in <code>arg_lo+0(FP)</code> or <code>arg_hi+4(FP)</code>.
|
||||
If a Go prototype does not name its result, the expected assembly name is <code>ret</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>SP</code> pseudo-register is a virtual stack pointer
|
||||
used to refer to frame-local variables and the arguments being
|
||||
prepared for function calls.
|
||||
It points to the top of the local stack frame, so references should use negative offsets
|
||||
in the range [−framesize, 0):
|
||||
<code>x-8(SP)</code>, <code>y-4(SP)</code>, and so on.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
On architectures with a hardware register named <code>SP</code>,
|
||||
the name prefix distinguishes
|
||||
references to the virtual stack pointer from references to the architectural
|
||||
<code>SP</code> register.
|
||||
That is, <code>x-8(SP)</code> and <code>-8(SP)</code>
|
||||
are different memory locations:
|
||||
the first refers to the virtual stack pointer pseudo-register,
|
||||
while the second refers to the
|
||||
hardware's <code>SP</code> register.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
On machines where <code>SP</code> and <code>PC</code> are
|
||||
traditionally aliases for a physical, numbered register,
|
||||
in the Go assembler the names <code>SP</code> and <code>PC</code>
|
||||
are still treated specially;
|
||||
for instance, references to <code>SP</code> require a symbol,
|
||||
much like <code>FP</code>.
|
||||
To access the actual hardware register use the true <code>R</code> name.
|
||||
For example, on the ARM architecture the hardware
|
||||
<code>SP</code> and <code>PC</code> are accessible as
|
||||
<code>R13</code> and <code>R15</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Branches and direct jumps are always written as offsets to the PC, or as
|
||||
jumps to labels:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
label:
|
||||
MOVW $0, R1
|
||||
JMP label
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Each label is visible only within the function in which it is defined.
|
||||
It is therefore permitted for multiple functions in a file to define
|
||||
and use the same label names.
|
||||
Direct jumps and call instructions can target text symbols,
|
||||
such as <code>name(SB)</code>, but not offsets from symbols,
|
||||
such as <code>name+4(SB)</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Instructions, registers, and assembler directives are always in UPPER CASE to remind you
|
||||
that assembly programming is a fraught endeavor.
|
||||
(Exception: the <code>g</code> register renaming on ARM.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In Go object files and binaries, the full name of a symbol is the
|
||||
package path followed by a period and the symbol name:
|
||||
<code>fmt.Printf</code> or <code>math/rand.Int</code>.
|
||||
Because the assembler's parser treats period and slash as punctuation,
|
||||
those strings cannot be used directly as identifier names.
|
||||
Instead, the assembler allows the middle dot character U+00B7
|
||||
and the division slash U+2215 in identifiers and rewrites them to
|
||||
plain period and slash.
|
||||
Within an assembler source file, the symbols above are written as
|
||||
<code>fmt·Printf</code> and <code>math∕rand·Int</code>.
|
||||
The assembly listings generated by the compilers when using the <code>-S</code> flag
|
||||
show the period and slash directly instead of the Unicode replacements
|
||||
required by the assemblers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Most hand-written assembly files do not include the full package path
|
||||
in symbol names, because the linker inserts the package path of the current
|
||||
object file at the beginning of any name starting with a period:
|
||||
in an assembly source file within the math/rand package implementation,
|
||||
the package's Int function can be referred to as <code>·Int</code>.
|
||||
This convention avoids the need to hard-code a package's import path in its
|
||||
own source code, making it easier to move the code from one location to another.
|
||||
</p>
|
||||
|
||||
<h3 id="directives">Directives</h3>
|
||||
|
||||
<p>
|
||||
The assembler uses various directives to bind text and data to symbol names.
|
||||
For example, here is a simple complete function definition. The <code>TEXT</code>
|
||||
directive declares the symbol <code>runtime·profileloop</code> and the instructions
|
||||
that follow form the body of the function.
|
||||
The last instruction in a <code>TEXT</code> block must be some sort of jump, usually a <code>RET</code> (pseudo-)instruction.
|
||||
(If it's not, the linker will append a jump-to-itself instruction; there is no fallthrough in <code>TEXTs</code>.)
|
||||
After the symbol, the arguments are flags (see below)
|
||||
and the frame size, a constant (but see below):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
TEXT runtime·profileloop(SB),NOSPLIT,$8
|
||||
MOVQ $runtime·profileloop1(SB), CX
|
||||
MOVQ CX, 0(SP)
|
||||
CALL runtime·externalthreadhandler(SB)
|
||||
RET
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
In the general case, the frame size is followed by an argument size, separated by a minus sign.
|
||||
(It's not a subtraction, just idiosyncratic syntax.)
|
||||
The frame size <code>$24-8</code> states that the function has a 24-byte frame
|
||||
and is called with 8 bytes of argument, which live on the caller's frame.
|
||||
If <code>NOSPLIT</code> is not specified for the <code>TEXT</code>,
|
||||
the argument size must be provided.
|
||||
For assembly functions with Go prototypes, <code>go</code> <code>vet</code> will check that the
|
||||
argument size is correct.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that the symbol name uses a middle dot to separate the components and is specified as an offset from the
|
||||
static base pseudo-register <code>SB</code>.
|
||||
This function would be called from Go source for package <code>runtime</code> using the
|
||||
simple name <code>profileloop</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Global data symbols are defined by a sequence of initializing
|
||||
<code>DATA</code> directives followed by a <code>GLOBL</code> directive.
|
||||
Each <code>DATA</code> directive initializes a section of the
|
||||
corresponding memory.
|
||||
The memory not explicitly initialized is zeroed.
|
||||
The general form of the <code>DATA</code> directive is
|
||||
|
||||
<pre>
|
||||
DATA symbol+offset(SB)/width, value
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
which initializes the symbol memory at the given offset and width with the given value.
|
||||
The <code>DATA</code> directives for a given symbol must be written with increasing offsets.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>GLOBL</code> directive declares a symbol to be global.
|
||||
The arguments are optional flags and the size of the data being declared as a global,
|
||||
which will have initial value all zeros unless a <code>DATA</code> directive
|
||||
has initialized it.
|
||||
The <code>GLOBL</code> directive must follow any corresponding <code>DATA</code> directives.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example,
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
DATA divtab<>+0x00(SB)/4, $0xf4f8fcff
|
||||
DATA divtab<>+0x04(SB)/4, $0xe6eaedf0
|
||||
...
|
||||
DATA divtab<>+0x3c(SB)/4, $0x81828384
|
||||
GLOBL divtab<>(SB), RODATA, $64
|
||||
|
||||
GLOBL runtime·tlsoffset(SB), NOPTR, $4
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
declares and initializes <code>divtab<></code>, a read-only 64-byte table of 4-byte integer values,
|
||||
and declares <code>runtime·tlsoffset</code>, a 4-byte, implicitly zeroed variable that
|
||||
contains no pointers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There may be one or two arguments to the directives.
|
||||
If there are two, the first is a bit mask of flags,
|
||||
which can be written as numeric expressions, added or or-ed together,
|
||||
or can be set symbolically for easier absorption by a human.
|
||||
Their values, defined in the standard <code>#include</code> file <code>textflag.h</code>, are:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<code>NOPROF</code> = 1
|
||||
<br>
|
||||
(For <code>TEXT</code> items.)
|
||||
Don't profile the marked function. This flag is deprecated.
|
||||
</li>
|
||||
<li>
|
||||
<code>DUPOK</code> = 2
|
||||
<br>
|
||||
It is legal to have multiple instances of this symbol in a single binary.
|
||||
The linker will choose one of the duplicates to use.
|
||||
</li>
|
||||
<li>
|
||||
<code>NOSPLIT</code> = 4
|
||||
<br>
|
||||
(For <code>TEXT</code> items.)
|
||||
Don't insert the preamble to check if the stack must be split.
|
||||
The frame for the routine, plus anything it calls, must fit in the
|
||||
spare space at the top of the stack segment.
|
||||
Used to protect routines such as the stack splitting code itself.
|
||||
</li>
|
||||
<li>
|
||||
<code>RODATA</code> = 8
|
||||
<br>
|
||||
(For <code>DATA</code> and <code>GLOBL</code> items.)
|
||||
Put this data in a read-only section.
|
||||
</li>
|
||||
<li>
|
||||
<code>NOPTR</code> = 16
|
||||
<br>
|
||||
(For <code>DATA</code> and <code>GLOBL</code> items.)
|
||||
This data contains no pointers and therefore does not need to be
|
||||
scanned by the garbage collector.
|
||||
</li>
|
||||
<li>
|
||||
<code>WRAPPER</code> = 32
|
||||
<br>
|
||||
(For <code>TEXT</code> items.)
|
||||
This is a wrapper function and should not count as disabling <code>recover</code>.
|
||||
</li>
|
||||
<li>
|
||||
<code>NEEDCTXT</code> = 64
|
||||
<br>
|
||||
(For <code>TEXT</code> items.)
|
||||
This function is a closure so it uses its incoming context register.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="runtime">Runtime Coordination</h3>
|
||||
|
||||
<p>
|
||||
For garbage collection to run correctly, the runtime must know the
|
||||
location of pointers in all global data and in most stack frames.
|
||||
The Go compiler emits this information when compiling Go source files,
|
||||
but assembly programs must define it explicitly.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A data symbol marked with the <code>NOPTR</code> flag (see above)
|
||||
is treated as containing no pointers to runtime-allocated data.
|
||||
A data symbol with the <code>RODATA</code> flag
|
||||
is allocated in read-only memory and is therefore treated
|
||||
as implicitly marked <code>NOPTR</code>.
|
||||
A data symbol with a total size smaller than a pointer
|
||||
is also treated as implicitly marked <code>NOPTR</code>.
|
||||
It is not possible to define a symbol containing pointers in an assembly source file;
|
||||
such a symbol must be defined in a Go source file instead.
|
||||
Assembly source can still refer to the symbol by name
|
||||
even without <code>DATA</code> and <code>GLOBL</code> directives.
|
||||
A good general rule of thumb is to define all non-<code>RODATA</code>
|
||||
symbols in Go instead of in assembly.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Each function also needs annotations giving the location of
|
||||
live pointers in its arguments, results, and local stack frame.
|
||||
For an assembly function with no pointer results and
|
||||
either no local stack frame or no function calls,
|
||||
the only requirement is to define a Go prototype for the function
|
||||
in a Go source file in the same package. The name of the assembly
|
||||
function must not contain the package name component (for example,
|
||||
function <code>Syscall</code> in package <code>syscall</code> should
|
||||
use the name <code>·Syscall</code> instead of the equivalent name
|
||||
<code>syscall·Syscall</code> in its <code>TEXT</code> directive).
|
||||
For more complex situations, explicit annotation is needed.
|
||||
These annotations use pseudo-instructions defined in the standard
|
||||
<code>#include</code> file <code>funcdata.h</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If a function has no arguments and no results,
|
||||
the pointer information can be omitted.
|
||||
This is indicated by an argument size annotation of <code>$<i>n</i>-0</code>
|
||||
on the <code>TEXT</code> instruction.
|
||||
Otherwise, pointer information must be provided by
|
||||
a Go prototype for the function in a Go source file,
|
||||
even for assembly functions not called directly from Go.
|
||||
(The prototype will also let <code>go</code> <code>vet</code> check the argument references.)
|
||||
At the start of the function, the arguments are assumed
|
||||
to be initialized but the results are assumed uninitialized.
|
||||
If the results will hold live pointers during a call instruction,
|
||||
the function should start by zeroing the results and then
|
||||
executing the pseudo-instruction <code>GO_RESULTS_INITIALIZED</code>.
|
||||
This instruction records that the results are now initialized
|
||||
and should be scanned during stack movement and garbage collection.
|
||||
It is typically easier to arrange that assembly functions do not
|
||||
return pointers or do not contain call instructions;
|
||||
no assembly functions in the standard library use
|
||||
<code>GO_RESULTS_INITIALIZED</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If a function has no local stack frame,
|
||||
the pointer information can be omitted.
|
||||
This is indicated by a local frame size annotation of <code>$0-<i>n</i></code>
|
||||
on the <code>TEXT</code> instruction.
|
||||
The pointer information can also be omitted if the
|
||||
function contains no call instructions.
|
||||
Otherwise, the local stack frame must not contain pointers,
|
||||
and the assembly must confirm this fact by executing the
|
||||
pseudo-instruction <code>NO_LOCAL_POINTERS</code>.
|
||||
Because stack resizing is implemented by moving the stack,
|
||||
the stack pointer may change during any function call:
|
||||
even pointers to stack data must not be kept in local variables.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Assembly functions should always be given Go prototypes,
|
||||
both to provide pointer information for the arguments and results
|
||||
and to let <code>go</code> <code>vet</code> check that
|
||||
the offsets being used to access them are correct.
|
||||
</p>
|
||||
|
||||
<h2 id="architectures">Architecture-specific details</h2>
|
||||
|
||||
<p>
|
||||
It is impractical to list all the instructions and other details for each machine.
|
||||
To see what instructions are defined for a given machine, say ARM,
|
||||
look in the source for the <code>obj</code> support library for
|
||||
that architecture, located in the directory <code>src/cmd/internal/obj/arm</code>.
|
||||
In that directory is a file <code>a.out.go</code>; it contains
|
||||
a long list of constants starting with <code>A</code>, like this:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
const (
|
||||
AAND = obj.ABaseARM + obj.A_ARCHSPECIFIC + iota
|
||||
AEOR
|
||||
ASUB
|
||||
ARSB
|
||||
AADD
|
||||
...
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This is the list of instructions and their spellings as known to the assembler and linker for that architecture.
|
||||
Each instruction begins with an initial capital <code>A</code> in this list, so <code>AAND</code>
|
||||
represents the bitwise and instruction,
|
||||
<code>AND</code> (without the leading <code>A</code>),
|
||||
and is written in assembly source as <code>AND</code>.
|
||||
The enumeration is mostly in alphabetical order.
|
||||
(The architecture-independent <code>AXXX</code>, defined in the
|
||||
<code>cmd/internal/obj</code> package,
|
||||
represents an invalid instruction).
|
||||
The sequence of the <code>A</code> names has nothing to do with the actual
|
||||
encoding of the machine instructions.
|
||||
The <code>cmd/internal/obj</code> package takes care of that detail.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The instructions for both the 386 and AMD64 architectures are listed in
|
||||
<code>cmd/internal/obj/x86/a.out.go</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The architectures share syntax for common addressing modes such as
|
||||
<code>(R1)</code> (register indirect),
|
||||
<code>4(R1)</code> (register indirect with offset), and
|
||||
<code>$foo(SB)</code> (absolute address).
|
||||
The assembler also supports some (not necessarily all) addressing modes
|
||||
specific to each architecture.
|
||||
The sections below list these.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
One detail evident in the examples from the previous sections is that data in the instructions flows from left to right:
|
||||
<code>MOVQ</code> <code>$0,</code> <code>CX</code> clears <code>CX</code>.
|
||||
This rule applies even on architectures where the conventional notation uses the opposite direction.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Here follow some descriptions of key Go-specific details for the supported architectures.
|
||||
</p>
|
||||
|
||||
<h3 id="x86">32-bit Intel 386</h3>
|
||||
|
||||
<p>
|
||||
The runtime pointer to the <code>g</code> structure is maintained
|
||||
through the value of an otherwise unused (as far as Go is concerned) register in the MMU.
|
||||
A OS-dependent macro <code>get_tls</code> is defined for the assembler if the source includes
|
||||
a special header, <code>go_asm.h</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
#include "go_asm.h"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Within the runtime, the <code>get_tls</code> macro loads its argument register
|
||||
with a pointer to the <code>g</code> pointer, and the <code>g</code> struct
|
||||
contains the <code>m</code> pointer.
|
||||
The sequence to load <code>g</code> and <code>m</code> using <code>CX</code> looks like this:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
get_tls(CX)
|
||||
MOVL g(CX), AX // Move g into AX.
|
||||
MOVL g_m(AX), BX // Move g.m into BX.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Addressing modes:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<code>(DI)(BX*2)</code>: The location at address <code>DI</code> plus <code>BX*2</code>.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>64(DI)(BX*2)</code>: The location at address <code>DI</code> plus <code>BX*2</code> plus 64.
|
||||
These modes accept only 1, 2, 4, and 8 as scale factors.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
When using the compiler and assembler's
|
||||
<code>-dynlink</code> or <code>-shared</code> modes,
|
||||
any load or store of a fixed memory location such as a global variable
|
||||
must be assumed to overwrite <code>CX</code>.
|
||||
Therefore, to be safe for use with these modes,
|
||||
assembly sources should typically avoid CX except between memory references.
|
||||
</p>
|
||||
|
||||
<h3 id="amd64">64-bit Intel 386 (a.k.a. amd64)</h3>
|
||||
|
||||
<p>
|
||||
The two architectures behave largely the same at the assembler level.
|
||||
Assembly code to access the <code>m</code> and <code>g</code>
|
||||
pointers on the 64-bit version is the same as on the 32-bit 386,
|
||||
except it uses <code>MOVQ</code> rather than <code>MOVL</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
get_tls(CX)
|
||||
MOVQ g(CX), AX // Move g into AX.
|
||||
MOVQ g_m(AX), BX // Move g.m into BX.
|
||||
</pre>
|
||||
|
||||
<h3 id="arm">ARM</h3>
|
||||
|
||||
<p>
|
||||
The registers <code>R10</code> and <code>R11</code>
|
||||
are reserved by the compiler and linker.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>R10</code> points to the <code>g</code> (goroutine) structure.
|
||||
Within assembler source code, this pointer must be referred to as <code>g</code>;
|
||||
the name <code>R10</code> is not recognized.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To make it easier for people and compilers to write assembly, the ARM linker
|
||||
allows general addressing forms and pseudo-operations like <code>DIV</code> or <code>MOD</code>
|
||||
that may not be expressible using a single hardware instruction.
|
||||
It implements these forms as multiple instructions, often using the <code>R11</code> register
|
||||
to hold temporary values.
|
||||
Hand-written assembly can use <code>R11</code>, but doing so requires
|
||||
being sure that the linker is not also using it to implement any of the other
|
||||
instructions in the function.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When defining a <code>TEXT</code>, specifying frame size <code>$-4</code>
|
||||
tells the linker that this is a leaf function that does not need to save <code>LR</code> on entry.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The name <code>SP</code> always refers to the virtual stack pointer described earlier.
|
||||
For the hardware register, use <code>R13</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Condition code syntax is to append a period and the one- or two-letter code to the instruction,
|
||||
as in <code>MOVW.EQ</code>.
|
||||
Multiple codes may be appended: <code>MOVM.IA.W</code>.
|
||||
The order of the code modifiers is irrelevant.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Addressing modes:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<code>R0->16</code>
|
||||
<br>
|
||||
<code>R0>>16</code>
|
||||
<br>
|
||||
<code>R0<<16</code>
|
||||
<br>
|
||||
<code>R0@>16</code>:
|
||||
For <code><<</code>, left shift <code>R0</code> by 16 bits.
|
||||
The other codes are <code>-></code> (arithmetic right shift),
|
||||
<code>>></code> (logical right shift), and
|
||||
<code>@></code> (rotate right).
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>R0->R1</code>
|
||||
<br>
|
||||
<code>R0>>R1</code>
|
||||
<br>
|
||||
<code>R0<<R1</code>
|
||||
<br>
|
||||
<code>R0@>R1</code>:
|
||||
For <code><<</code>, left shift <code>R0</code> by the count in <code>R1</code>.
|
||||
The other codes are <code>-></code> (arithmetic right shift),
|
||||
<code>>></code> (logical right shift), and
|
||||
<code>@></code> (rotate right).
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>[R0,g,R12-R15]</code>: For multi-register instructions, the set comprising
|
||||
<code>R0</code>, <code>g</code>, and <code>R12</code> through <code>R15</code> inclusive.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>(R5, R6)</code>: Destination register pair.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="arm64">ARM64</h3>
|
||||
|
||||
<p>
|
||||
The ARM64 port is in an experimental state.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Instruction modifiers are appended to the instruction following a period.
|
||||
The only modifiers are <code>P</code> (postincrement) and <code>W</code>
|
||||
(preincrement):
|
||||
<code>MOVW.P</code>, <code>MOVW.W</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Addressing modes:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<code>(R5, R6)</code>: Register pair for <code>LDP</code>/<code>STP</code>.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="ppc64">64-bit PowerPC, a.k.a. ppc64</h3>
|
||||
|
||||
<p>
|
||||
The 64-bit PowerPC port is in an experimental state.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Addressing modes:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<code>(R5)(R6*1)</code>: The location at <code>R5</code> plus <code>R6</code>. It is a scaled
|
||||
mode as on the x86, but the only scale allowed is <code>1</code>.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>(R5+R6)</code>: Alias for (R5)(R6*1)
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="s390x">IBM z/Architecture, a.k.a. s390x</h3>
|
||||
|
||||
<p>
|
||||
The registers <code>R10</code> and <code>R11</code> are reserved.
|
||||
The assembler uses them to hold temporary values when assembling some instructions.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>R13</code> points to the <code>g</code> (goroutine) structure.
|
||||
This register must be referred to as <code>g</code>; the name <code>R13</code> is not recognized.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>R15</code> points to the stack frame and should typically only be accessed using the
|
||||
virtual registers <code>SP</code> and <code>FP</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Load- and store-multiple instructions operate on a range of registers.
|
||||
The range of registers is specified by a start register and an end register.
|
||||
For example, <code>LMG</code> <code>(R9),</code> <code>R5,</code> <code>R7</code> would load
|
||||
<code>R5</code>, <code>R6</code> and <code>R7</code> with the 64-bit values at
|
||||
<code>0(R9)</code>, <code>8(R9)</code> and <code>16(R9)</code> respectively.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Storage-and-storage instructions such as <code>MVC</code> and <code>XC</code> are written
|
||||
with the length as the first argument.
|
||||
For example, <code>XC</code> <code>$8,</code> <code>(R9),</code> <code>(R9)</code> would clear
|
||||
eight bytes at the address specified in <code>R9</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If a vector instruction takes a length or an index as an argument then it will be the
|
||||
first argument.
|
||||
For example, <code>VLEIF</code> <code>$1,</code> <code>$16,</code> <code>V2</code> will load
|
||||
the value sixteen into index one of <code>V2</code>.
|
||||
Care should be taken when using vector instructions to ensure that they are available at
|
||||
runtime.
|
||||
To use vector instructions a machine must have both the vector facility (bit 129 in the
|
||||
facility list) and kernel support.
|
||||
Without kernel support a vector instruction will have no effect (it will be equivalent
|
||||
to a <code>NOP</code> instruction).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Addressing modes:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<code>(R5)(R6*1)</code>: The location at <code>R5</code> plus <code>R6</code>.
|
||||
It is a scaled mode as on the x86, but the only scale allowed is <code>1</code>.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="mips">MIPS, MIPS64</h3>
|
||||
|
||||
<p>
|
||||
General purpose registers are named <code>R0</code> through <code>R31</code>,
|
||||
floating point registers are <code>F0</code> through <code>F31</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>R30</code> is reserved to point to <code>g</code>.
|
||||
<code>R23</code> is used as a temporary register.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In a <code>TEXT</code> directive, the frame size <code>$-4</code> for MIPS or
|
||||
<code>$-8</code> for MIPS64 instructs the linker not to save <code>LR</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>SP</code> refers to the virtual stack pointer.
|
||||
For the hardware register, use <code>R29</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Addressing modes:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<code>16(R1)</code>: The location at <code>R1</code> plus 16.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<code>(R1)</code>: Alias for <code>0(R1)</code>.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="unsupported_opcodes">Unsupported opcodes</h3>
|
||||
|
||||
<p>
|
||||
The assemblers are designed to support the compiler so not all hardware instructions
|
||||
are defined for all architectures: if the compiler doesn't generate it, it might not be there.
|
||||
If you need to use a missing instruction, there are two ways to proceed.
|
||||
One is to update the assembler to support that instruction, which is straightforward
|
||||
but only worthwhile if it's likely the instruction will be used again.
|
||||
Instead, for simple one-off cases, it's possible to use the <code>BYTE</code>
|
||||
and <code>WORD</code> directives
|
||||
to lay down explicit data into the instruction stream within a <code>TEXT</code>.
|
||||
Here's how the 386 runtime defines the 64-bit atomic load function.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
// uint64 atomicload64(uint64 volatile* addr);
|
||||
// so actually
|
||||
// void atomicload64(uint64 *res, uint64 volatile *addr);
|
||||
TEXT runtime·atomicload64(SB), NOSPLIT, $0-12
|
||||
MOVL ptr+0(FP), AX
|
||||
TESTL $7, AX
|
||||
JZ 2(PC)
|
||||
MOVL 0, AX // crash with nil ptr deref
|
||||
LEAL ret_lo+4(FP), BX
|
||||
// MOVQ (%EAX), %MM0
|
||||
BYTE $0x0f; BYTE $0x6f; BYTE $0x00
|
||||
// MOVQ %MM0, 0(%EBX)
|
||||
BYTE $0x0f; BYTE $0x7f; BYTE $0x03
|
||||
// EMMS
|
||||
BYTE $0x0F; BYTE $0x77
|
||||
RET
|
||||
</pre>
|
||||
BIN
doc/button_background.png
Normal file
BIN
doc/button_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 126 B |
101
doc/cmd.html
101
doc/cmd.html
@@ -1,101 +0,0 @@
|
||||
<!--{
|
||||
"Title": "Command Documentation",
|
||||
"Path": "/doc/cmd"
|
||||
}-->
|
||||
|
||||
<p>
|
||||
There is a suite of programs to build and process Go source code.
|
||||
Instead of being run directly, programs in the suite are usually invoked
|
||||
by the <a href="/cmd/go/">go</a> program.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The most common way to run these programs is as a subcommand of the go program,
|
||||
for instance as <code>go fmt</code>. Run like this, the command operates on
|
||||
complete packages of Go source code, with the go program invoking the
|
||||
underlying binary with arguments appropriate to package-level processing.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The programs can also be run as stand-alone binaries, with unmodified arguments,
|
||||
using the go <code>tool</code> subcommand, such as <code>go tool vet</code>.
|
||||
This style of invocation allows, for instance, checking a single source file
|
||||
rather than an entire package: <code>go tool vet myprogram.go</code> as
|
||||
compared to <code>go vet mypackage</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Finally the <code>fmt</code> and <code>godoc</code> commands are installed
|
||||
as regular binaries called <code>gofmt</code> and <code>godoc</code> because
|
||||
they are so often referenced.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Click on the links for more documentation, invocation methods, and usage details.
|
||||
</p>
|
||||
|
||||
<table class="dir">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th> </th>
|
||||
<th>Synopsis</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="/cmd/go/">go</a></td>
|
||||
<td> </td>
|
||||
<td>
|
||||
The <code>go</code> program manages Go source code and runs the other
|
||||
commands listed here.
|
||||
See the command docs for usage
|
||||
details.
|
||||
<br><br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="/cmd/cgo/">cgo</a></td>
|
||||
<td> </td>
|
||||
<td>Cgo enables the creation of Go packages that call C code.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="//godoc.org/golang.org/x/tools/cmd/cover/">cover</a></td>
|
||||
<td> </td>
|
||||
<td>Cover is a program for creating and analyzing the coverage profiles
|
||||
generated by <code>"go test -coverprofile"</code>.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="/cmd/fix/">fix</a></td>
|
||||
<td> </td>
|
||||
<td>Fix finds Go programs that use old features of the language and libraries
|
||||
and rewrites them to use newer ones.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="/cmd/go/">fmt</a></td>
|
||||
<td> </td>
|
||||
<td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/">
|
||||
gofmt</a> command with more general options.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="//godoc.org/golang.org/x/tools/cmd/godoc/">godoc</a></td>
|
||||
<td> </td>
|
||||
<td>Godoc extracts and generates documentation for Go packages.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="/cmd/vet/">vet</a></td>
|
||||
<td> </td>
|
||||
<td>Vet examines Go source code and reports suspicious constructs, such as Printf
|
||||
calls whose arguments do not align with the format string.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p>
|
||||
This is an abridged list. See the <a href="/cmd/">full command reference</a>
|
||||
for documentation of the compilers and more.
|
||||
</p>
|
||||
881
doc/code.html
881
doc/code.html
@@ -1,679 +1,368 @@
|
||||
<!--{
|
||||
"Title": "How to Write Go Code"
|
||||
}-->
|
||||
<!-- How to Write Go Code -->
|
||||
|
||||
<h2 id="Introduction">Introduction</h2>
|
||||
|
||||
<p>
|
||||
This document demonstrates the development of a simple Go package and
|
||||
introduces the <a href="/cmd/go/">go tool</a>, the standard way to fetch,
|
||||
build, and install Go packages and commands.
|
||||
This document explains how to write a new package
|
||||
and how to test code.
|
||||
It assumes you have installed Go using the
|
||||
<a href="install.html">installation instructions</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>go</code> tool requires you to organize your code in a specific
|
||||
way. Please read this document carefully.
|
||||
It explains the simplest way to get up and running with your Go installation.
|
||||
Before embarking on a change to an existing
|
||||
package or the creation of a new package,
|
||||
be sure to send mail to the
|
||||
<a href="http://groups.google.com/group/golang-nuts">mailing list</a>
|
||||
to let people know what you are thinking of doing.
|
||||
Doing so helps avoid duplication of effort and
|
||||
enables discussions about design before any code
|
||||
has been written.
|
||||
</p>
|
||||
|
||||
<h2 id="Community_resources">Community resources</h2>
|
||||
|
||||
<p>
|
||||
For real-time help, there may be users or developers on
|
||||
<code>#go-nuts</code> on the <a href="http://freenode.net/">Freenode</a> IRC server.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A similar explanation is available as a
|
||||
<a href="//www.youtube.com/watch?v=XCsL89YtqCs">screencast</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="Organization">Code organization</h2>
|
||||
|
||||
<h3 id="Overview">Overview</h3>
|
||||
|
||||
<ul>
|
||||
<li>Go programmers typically keep all their Go code in a single <i>workspace</i>.</li>
|
||||
<li>A workspace contains many version control <i>repositories</i>
|
||||
(managed by Git, for example).</li>
|
||||
<li>Each repository contains one or more <i>packages</i>.</li>
|
||||
<li>Each package consists of one or more Go source files in a single directory.</li>
|
||||
<li>The path to a package's directory determines its <i>import path</i>.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Note that this differs from other programming environments in which every
|
||||
project has a separate workspace and workspaces are closely tied to version
|
||||
control repositories.
|
||||
</p>
|
||||
|
||||
<h3 id="Workspaces">Workspaces</h3>
|
||||
|
||||
<p>
|
||||
A workspace is a directory hierarchy with three directories at its root:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><code>src</code> contains Go source files,
|
||||
<li><code>pkg</code> contains package objects, and
|
||||
<li><code>bin</code> contains executable commands.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
The <code>go</code> tool builds source packages and installs the resulting
|
||||
binaries to the <code>pkg</code> and <code>bin</code> directories.
|
||||
The official mailing list for discussion of the Go language is
|
||||
<a href="http://groups.google.com/group/golang-nuts">Go Nuts</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>src</code> subdirectory typically contains multiple version control
|
||||
repositories (such as for Git or Mercurial) that track the development of one
|
||||
or more source packages.
|
||||
Bugs can be reported using the <a href="http://code.google.com/p/go/issues/list">Go issue tracker</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To give you an idea of how a workspace looks in practice, here's an example:
|
||||
For those who wish to keep up with development,
|
||||
there is another mailing list, <a href="http://groups.google.com/group/golang-checkins">golang-checkins</a>,
|
||||
that receives a message summarizing each checkin to the Go repository.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="New_package">Creating a new package</h2>
|
||||
|
||||
<p>
|
||||
The source code for the package with import path
|
||||
<code>x/y</code> is, by convention, kept in the
|
||||
directory <code>$GOROOT/src/pkg/x/y</code>.
|
||||
</p>
|
||||
|
||||
<h3>Makefile</h3>
|
||||
|
||||
<p>
|
||||
It would be nice to have Go-specific tools that
|
||||
inspect the source files to determine what to build and in
|
||||
what order, but for now, Go uses GNU <code>make</code>.
|
||||
Thus, the first file to create in a new package directory is
|
||||
usually the <code>Makefile</code>.
|
||||
The basic form used in the Go source tree
|
||||
is illustrated by <a href="../src/pkg/container/vector/Makefile"><code>src/pkg/container/vector/Makefile</code></a>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
bin/
|
||||
hello # command executable
|
||||
outyet # command executable
|
||||
pkg/
|
||||
linux_amd64/
|
||||
github.com/golang/example/
|
||||
stringutil.a # package object
|
||||
src/
|
||||
<a href="https://github.com/golang/example/">github.com/golang/example/</a>
|
||||
.git/ # Git repository metadata
|
||||
hello/
|
||||
hello.go # command source
|
||||
outyet/
|
||||
main.go # command source
|
||||
main_test.go # test source
|
||||
stringutil/
|
||||
reverse.go # package source
|
||||
reverse_test.go # test source
|
||||
<a href="https://golang.org/x/image/">golang.org/x/image/</a>
|
||||
.git/ # Git repository metadata
|
||||
bmp/
|
||||
reader.go # package source
|
||||
writer.go # package source
|
||||
... (many more repositories and packages omitted) ...
|
||||
include ../../../Make.inc
|
||||
|
||||
TARG=container/vector
|
||||
GOFILES=\
|
||||
intvector.go\
|
||||
stringvector.go\
|
||||
vector.go\
|
||||
|
||||
include ../../../Make.pkg
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The tree above shows a workspace containing two repositories
|
||||
(<code>example</code> and <code>image</code>).
|
||||
The <code>example</code> repository contains two commands (<code>hello</code>
|
||||
and <code>outyet</code>) and one library (<code>stringutil</code>).
|
||||
The <code>image</code> repository contains the <code>bmp</code> package
|
||||
and <a href="https://godoc.org/golang.org/x/image">several others</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A typical workspace contains many source repositories containing many
|
||||
packages and commands. Most Go programmers keep <i>all</i> their Go source code
|
||||
and dependencies in a single workspace.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Commands and libraries are built from different kinds of source packages.
|
||||
We will discuss the distinction <a href="#PackageNames">later</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<h3 id="GOPATH">The <code>GOPATH</code> environment variable</h3>
|
||||
|
||||
<p>
|
||||
The <code>GOPATH</code> environment variable specifies the location of your
|
||||
workspace. It defaults to a directory named <code>go</code> inside your home directory,
|
||||
so <code>$HOME/go</code> on Unix,
|
||||
<code>$home/go</code> on Plan 9,
|
||||
and <code>%USERPROFILE%\go</code> (usually <code>C:\Users\YourName\go</code>) on Windows.
|
||||
If you would like to work in a different location, you will need to set
|
||||
<code>GOPATH</code> to the path to that directory.
|
||||
(Another common setup is to set <code>GOPATH=$HOME</code>.)
|
||||
Note that <code>GOPATH</code> must <b>not</b> be the
|
||||
same path as your Go installation.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The command <code>go</code> <code>env</code> <code>GOPATH</code>
|
||||
prints the effective current <code>GOPATH</code>;
|
||||
it prints the default location if the environment variable is unset.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For convenience, add the workspace's <code>bin</code> subdirectory
|
||||
to your <code>PATH</code>:
|
||||
Outside the Go source tree (for personal packages), the standard form is
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>export PATH=$PATH:$(go env GOPATH)/bin</b>
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=mypackage
|
||||
GOFILES=\
|
||||
my1.go\
|
||||
my2.go\
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The scripts in the rest of this document use <code>$GOPATH</code>
|
||||
instead of <code>$(go env GOPATH)</code> for brevity.
|
||||
To make the scripts run as written
|
||||
if you have not set GOPATH,
|
||||
you can substitute $HOME/go in those commands
|
||||
or else run:
|
||||
The first and last lines <code>include</code> standard definitions and rules.
|
||||
Packages maintained in the standard Go tree use a relative path (instead of
|
||||
<code>$(GOROOT)/src</code>) so that <code>make</code> will work correctly
|
||||
even if <code>$(GOROOT)</code> contains spaces.
|
||||
This makes it easy for programmers to try Go.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you have not set <code>$GOROOT</code> in your environment,
|
||||
you must run <code>gomake</code> to use this form of makefile.
|
||||
<code>Gomake</code> also takes care to invoke GNU Make
|
||||
even on systems where it is installed as <code>gmake</code>
|
||||
rather than <code>make</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>TARG</code> is the target install path for the package,
|
||||
the string that clients will use to import it.
|
||||
Inside the Go tree, this string should be the same as the directory
|
||||
in which the <code>Makefile</code> appears, with the
|
||||
<code>$GOROOT/src/pkg/</code> prefix removed.
|
||||
Outside the Go tree, you can use any <code>TARG</code> you
|
||||
want that doesn't conflict with the standard Go package names.
|
||||
A common convention is to use an identifying top-level name
|
||||
to group your packages: <code>myname/tree</code>, <code>myname/filter</code>, etc.
|
||||
Note that even if you keep your package source outside the
|
||||
Go tree, running <code>make install</code> installs your
|
||||
package binaries in the standard location—<code>$GOROOT/pkg</code>—to
|
||||
make it easy to find them.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>GOFILES</code> is a list of source files to compile to
|
||||
create the package. The trailing <code>\</code> characters
|
||||
allow the list to be split onto multiple lines
|
||||
for easy sorting.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you create a new package directory in the Go tree, add it to the list in
|
||||
<code>$GOROOT/src/pkg/Makefile</code> so that it
|
||||
is included in the standard build. Then run:
|
||||
<pre>
|
||||
$ <b>export GOPATH=$(go env GOPATH)</b>
|
||||
cd $GOROOT/src/pkg
|
||||
./deps.bash
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
To learn more about the <code>GOPATH</code> environment variable, see
|
||||
<a href="/cmd/go/#hdr-GOPATH_environment_variable"><code>'go help gopath'</code></a>.
|
||||
to update the dependency file <code>Make.deps</code>.
|
||||
(This happens automatically each time you run <code>all.bash</code>
|
||||
or <code>make.bash</code>.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To use a custom workspace location,
|
||||
<a href="https://golang.org/wiki/SettingGOPATH">set the <code>GOPATH</code> environment variable</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="ImportPaths">Import paths</h3>
|
||||
|
||||
<p>
|
||||
An <i>import path</i> is a string that uniquely identifies a package.
|
||||
A package's import path corresponds to its location inside a workspace
|
||||
or in a remote repository (explained below).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The packages from the standard library are given short import paths such as
|
||||
<code>"fmt"</code> and <code>"net/http"</code>.
|
||||
For your own packages, you must choose a base path that is unlikely to
|
||||
collide with future additions to the standard library or other external
|
||||
libraries.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you keep your code in a source repository somewhere, then you should use the
|
||||
root of that source repository as your base path.
|
||||
For instance, if you have a <a href="https://github.com/">GitHub</a> account at
|
||||
<code>github.com/user</code>, that should be your base path.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that you don't need to publish your code to a remote repository before you
|
||||
can build it. It's just a good habit to organize your code as if you will
|
||||
publish it someday. In practice you can choose any arbitrary path name,
|
||||
as long as it is unique to the standard library and greater Go ecosystem.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We'll use <code>github.com/user</code> as our base path. Create a directory
|
||||
inside your workspace in which to keep source code:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>mkdir -p $GOPATH/src/github.com/user</b>
|
||||
</pre>
|
||||
|
||||
|
||||
<h3 id="Command">Your first program</h3>
|
||||
|
||||
<p>
|
||||
To compile and run a simple program, first choose a package path (we'll use
|
||||
<code>github.com/user/hello</code>) and create a corresponding package directory
|
||||
inside your workspace:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>mkdir $GOPATH/src/github.com/user/hello</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Next, create a file named <code>hello.go</code> inside that directory,
|
||||
containing the following Go code.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Printf("Hello, world.\n")
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Now you can build and install that program with the <code>go</code> tool:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>go install github.com/user/hello</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Note that you can run this command from anywhere on your system. The
|
||||
<code>go</code> tool finds the source code by looking for the
|
||||
<code>github.com/user/hello</code> package inside the workspace specified by
|
||||
<code>GOPATH</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can also omit the package path if you run <code>go install</code> from the
|
||||
package directory:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>cd $GOPATH/src/github.com/user/hello</b>
|
||||
$ <b>go install</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This command builds the <code>hello</code> command, producing an executable
|
||||
binary. It then installs that binary to the workspace's <code>bin</code>
|
||||
directory as <code>hello</code> (or, under Windows, <code>hello.exe</code>).
|
||||
In our example, that will be <code>$GOPATH/bin/hello</code>, which is
|
||||
<code>$HOME/work/bin/hello</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>go</code> tool will only print output when an error occurs, so if
|
||||
these commands produce no output they have executed successfully.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can now run the program by typing its full path at the command line:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>$GOPATH/bin/hello</b>
|
||||
Hello, world.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Or, as you have added <code>$GOPATH/bin</code> to your <code>PATH</code>,
|
||||
just type the binary name:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>hello</b>
|
||||
Hello, world.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If you're using a source control system, now would be a good time to initialize
|
||||
a repository, add the files, and commit your first change. Again, this step is
|
||||
optional: you do not need to use source control to write Go code.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>cd $GOPATH/src/github.com/user/hello</b>
|
||||
$ <b>git init</b>
|
||||
Initialized empty Git repository in /home/user/work/src/github.com/user/hello/.git/
|
||||
$ <b>git add hello.go</b>
|
||||
$ <b>git commit -m "initial commit"</b>
|
||||
[master (root-commit) 0b4507d] initial commit
|
||||
1 file changed, 1 insertion(+)
|
||||
create mode 100644 hello.go
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Pushing the code to a remote repository is left as an exercise for the reader.
|
||||
If you change the imports of an existing package,
|
||||
you do not need to edit <code>$GOROOT/src/pkg/Makefile</code>
|
||||
but you will still need to run <code>deps.bash</code> as above.
|
||||
</p>
|
||||
|
||||
|
||||
<h3 id="Library">Your first library</h3>
|
||||
<h3>Go source files</h3>
|
||||
|
||||
<p>
|
||||
Let's write a library and use it from the <code>hello</code> program.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Again, the first step is to choose a package path (we'll use
|
||||
<code>github.com/user/stringutil</code>) and create the package directory:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>mkdir $GOPATH/src/github.com/user/stringutil</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Next, create a file named <code>reverse.go</code> in that directory with the
|
||||
following contents.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
// Package stringutil contains utility functions for working with strings.
|
||||
package stringutil
|
||||
|
||||
// Reverse returns its argument string reversed rune-wise left to right.
|
||||
func Reverse(s string) string {
|
||||
r := []rune(s)
|
||||
for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
|
||||
r[i], r[j] = r[j], r[i]
|
||||
}
|
||||
return string(r)
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Now, test that the package compiles with <code>go build</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>go build github.com/user/stringutil</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Or, if you are working in the package's source directory, just:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>go build</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This won't produce an output file. To do that, you must use <code>go
|
||||
install</code>, which places the package object inside the <code>pkg</code>
|
||||
directory of the workspace.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
After confirming that the <code>stringutil</code> package builds,
|
||||
modify your original <code>hello.go</code> (which is in
|
||||
<code>$GOPATH/src/github.com/user/hello</code>) to use it:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
<b>"github.com/user/stringutil"</b>
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Printf(stringutil.Reverse("!oG ,olleH"))
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Whenever the <code>go</code> tool installs a package or binary, it also
|
||||
installs whatever dependencies it has.
|
||||
So when you install the <code>hello</code> program
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>go install github.com/user/hello</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
the <code>stringutil</code> package will be installed as well, automatically.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Running the new version of the program, you should see a new, reversed message:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>hello</b>
|
||||
Hello, Go!
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
After the steps above, your workspace should look like this:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
bin/
|
||||
hello # command executable
|
||||
pkg/
|
||||
linux_amd64/ # this will reflect your OS and architecture
|
||||
github.com/user/
|
||||
stringutil.a # package object
|
||||
src/
|
||||
github.com/user/
|
||||
hello/
|
||||
hello.go # command source
|
||||
stringutil/
|
||||
reverse.go # package source
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Note that <code>go install</code> placed the <code>stringutil.a</code> object
|
||||
in a directory inside <code>pkg/linux_amd64</code> that mirrors its source
|
||||
directory.
|
||||
This is so that future invocations of the <code>go</code> tool can find the
|
||||
package object and avoid recompiling the package unnecessarily.
|
||||
The <code>linux_amd64</code> part is there to aid in cross-compilation,
|
||||
and will reflect the operating system and architecture of your system.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Go command executables are statically linked; the package objects need not
|
||||
be present to run Go programs.
|
||||
</p>
|
||||
|
||||
|
||||
<h3 id="PackageNames">Package names</h3>
|
||||
|
||||
<p>
|
||||
The first statement in a Go source file must be
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
package <i>name</i>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
where <code><i>name</i></code> is the package's default name for imports.
|
||||
The first statement in each of the source files listed in the <code>Makefile</code>
|
||||
should be <code>package <i>name</i></code>, where <code><i>name</i></code>
|
||||
is the package's default name for imports.
|
||||
(All files in a package must use the same <code><i>name</i></code>.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Go's convention is that the package name is the last element of the
|
||||
import path: the package imported as "<code>crypto/rot13</code>"
|
||||
import path: the package imported as <code>"crypto/rot13"</code>
|
||||
should be named <code>rot13</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Executable commands must always use <code>package main</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There is no requirement that package names be unique
|
||||
across all packages linked into a single binary,
|
||||
only that the import paths (their full file names) be unique.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
See <a href="/doc/effective_go.html#names">Effective Go</a> to learn more about
|
||||
Go's naming conventions.
|
||||
Go compiles all the source files in a package at once, so one file
|
||||
can refer to constants, variables, types, and functions in another
|
||||
file without special arrangement or declarations.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Writing clean, idiomatic Go code is beyond the scope of this document.
|
||||
<a href="effective_go.html">Effective Go</a> is an introduction to
|
||||
that topic.
|
||||
</p>
|
||||
|
||||
<h2 id="Building_programs">Building programs</h2>
|
||||
<p>To build a Go program with gomake, create a Makefile alongside your program's
|
||||
source files. It should be similar to the example above, but include
|
||||
<code>Make.cmd</code> instead of <code>Make.pkg</code>:
|
||||
|
||||
<pre>
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=helloworld
|
||||
GOFILES=\
|
||||
helloworld.go\
|
||||
|
||||
include $(GOROOT)/src/Make.cmd
|
||||
</pre>
|
||||
|
||||
<p>Running <code>gomake</code> will compile <code>helloworld.go</code>
|
||||
and produce an executable named <code>helloworld</code> in the current
|
||||
directory.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Running <code>gomake install</code> will build <code>helloworld</code> if
|
||||
necessary and copy it to the <code>$GOBIN</code> directory
|
||||
(<code>$GOROOT/bin/</code> is the default).
|
||||
</p>
|
||||
|
||||
<h2 id="Testing">Testing</h2>
|
||||
|
||||
<p>
|
||||
Go has a lightweight test framework composed of the <code>go test</code>
|
||||
command and the <code>testing</code> package.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Go has a lightweight test framework known as <code>gotest</code>.
|
||||
You write a test by creating a file with a name ending in <code>_test.go</code>
|
||||
that contains functions named <code>TestXXX</code> with signature
|
||||
<code>func (t *testing.T)</code>.
|
||||
that contains functions named <code>TestXXX</code> with signature <code>func (t *testing.T)</code>.
|
||||
The test framework runs each such function;
|
||||
if the function calls a failure function such as <code>t.Error</code> or
|
||||
<code>t.Fail</code>, the test is considered to have failed.
|
||||
if the function calls a failure function such as <code>t.Error</code> or <code>t.Fail</code>, the test is considered to have failed.
|
||||
The <a href="/cmd/gotest/">gotest command documentation</a>
|
||||
and the <a href="/pkg/testing/">testing package documentation</a> give more detail.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Add a test to the <code>stringutil</code> package by creating the file
|
||||
<code>$GOPATH/src/github.com/user/stringutil/reverse_test.go</code> containing
|
||||
the following Go code.
|
||||
The <code>*_test.go</code> files should not be listed in the <code>Makefile</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To run the test, run either <code>make test</code> or <code>gotest</code>
|
||||
(they are equivalent).
|
||||
To run only the tests in a single test file, for instance <code>one_test.go</code>,
|
||||
run <code>gotest one_test.go</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If your change affects performance, add a <code>Benchmark</code> function
|
||||
(see the <a href="/cmd/gotest/">gotest command documentation</a>)
|
||||
and run it using <code>gotest -test.bench=.</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Once your new code is tested and working,
|
||||
it's time to get it <a href="contribute.html">reviewed and submitted</a>.
|
||||
</p>
|
||||
|
||||
<h2 id="pkg_example">An example package with tests</h2>
|
||||
|
||||
<p>
|
||||
This example package, <code>numbers</code>, consists of the function
|
||||
<code>Double</code>, which takes an <code>int</code> and returns that value
|
||||
multiplied by 2. It consists of three files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, the package implementation, <code>numbers.go</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
package stringutil
|
||||
package numbers
|
||||
|
||||
import "testing"
|
||||
func Double(i int) int {
|
||||
return i * 2
|
||||
}
|
||||
</pre>
|
||||
|
||||
func TestReverse(t *testing.T) {
|
||||
cases := []struct {
|
||||
in, want string
|
||||
}{
|
||||
{"Hello, world", "dlrow ,olleH"},
|
||||
{"Hello, 世界", "界世 ,olleH"},
|
||||
{"", ""},
|
||||
}
|
||||
for _, c := range cases {
|
||||
got := Reverse(c.in)
|
||||
if got != c.want {
|
||||
t.Errorf("Reverse(%q) == %q, want %q", c.in, got, c.want)
|
||||
<p>
|
||||
Next, the tests, <code>numbers_test.go</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
package numbers
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
type doubleTest struct {
|
||||
in, out int
|
||||
}
|
||||
|
||||
var doubleTests = []doubleTest{
|
||||
doubleTest{1, 2},
|
||||
doubleTest{2, 4},
|
||||
doubleTest{-5, -10},
|
||||
}
|
||||
|
||||
func TestDouble(t *testing.T) {
|
||||
for _, dt := range doubleTests {
|
||||
v := Double(dt.in)
|
||||
if v != dt.out {
|
||||
t.Errorf("Double(%d) = %d, want %d.", dt.in, v, dt.out)
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Then run the test with <code>go test</code>:
|
||||
Finally, the <code>Makefile</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>go test github.com/user/stringutil</b>
|
||||
ok github.com/user/stringutil 0.165s
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=numbers
|
||||
GOFILES=\
|
||||
numbers.go\
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
As always, if you are running the <code>go</code> tool from the package
|
||||
directory, you can omit the package path:
|
||||
Running <code>gomake install</code> will build and install the package to
|
||||
the <code>$GOROOT/pkg/</code> directory (it can then be used by any
|
||||
program on the system).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Running <code>gomake test</code> (or just running the command
|
||||
<code>gotest</code>) will rebuild the package, including the
|
||||
<code>numbers_test.go</code> file, and then run the <code>TestDouble</code>
|
||||
function. The output "<code>PASS</code>" indicates that all tests passed
|
||||
successfully. Breaking the implementation by changing the multiplier from
|
||||
<code>2</code> to <code>3</code> will allow you to see how failing tests are
|
||||
reported.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
See the <a href="/cmd/gotest/">gotest documentation</a> and the
|
||||
<a href="/pkg/testing/">testing package</a> for more detail.
|
||||
</p>
|
||||
|
||||
<h2 id="arch_os_specific">Architecture- and operating system-specific code</h2>
|
||||
|
||||
<p>First, a disclaimer: very few Go packages should need to know about the
|
||||
hardware and operating system they run on. In the vast majority of cases the
|
||||
language and standard library handle most portability issues. This section is
|
||||
a guide for experienced systems programmers who have a good reason to write
|
||||
platform-specific code, such as assembly-language support for fast
|
||||
trigonometric functions or code that implements a common interface above
|
||||
different operating systems.</p>
|
||||
|
||||
<p>To compile such code, use the <code>$GOOS</code> and <code>$GOARCH</code>
|
||||
<a href="/doc/install.html#environment">environment variables</a> in your
|
||||
source file names and <code>Makefile</code>.</p>
|
||||
|
||||
<p>For example, this <code>Makefile</code> describes a package that builds on
|
||||
different operating systems by parameterizing the file name with
|
||||
<code>$GOOS</code>.</p>
|
||||
|
||||
<pre>
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=mypackage
|
||||
GOFILES=\
|
||||
my.go\
|
||||
my_$(GOOS).go\
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
</pre>
|
||||
|
||||
<p>The OS-specific code goes in <code>my_linux.go</code>,
|
||||
<code>my_darwin.go</code>, and so on.</p>
|
||||
|
||||
<p>If you follow these conventional parameterizations, tools such as
|
||||
<a href="/cmd/goinstall/">goinstall</a> will work seamlessly with your package:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>go test</b>
|
||||
ok github.com/user/stringutil 0.165s
|
||||
my_$(GOOS).go
|
||||
my_$(GOARCH).go
|
||||
my_$(GOOS)_$(GOARCH).go
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Run <code><a href="/cmd/go/#hdr-Test_packages">go help test</a></code> and see the
|
||||
<a href="/pkg/testing/">testing package documentation</a> for more detail.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="remote">Remote packages</h2>
|
||||
|
||||
<p>
|
||||
An import path can describe how to obtain the package source code using a
|
||||
revision control system such as Git or Mercurial. The <code>go</code> tool uses
|
||||
this property to automatically fetch packages from remote repositories.
|
||||
For instance, the examples described in this document are also kept in a
|
||||
Git repository hosted at GitHub
|
||||
<code><a href="https://github.com/golang/example">github.com/golang/example</a></code>.
|
||||
If you include the repository URL in the package's import path,
|
||||
<code>go get</code> will fetch, build, and install it automatically:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>go get github.com/golang/example/hello</b>
|
||||
$ <b>$GOPATH/bin/hello</b>
|
||||
Hello, Go examples!
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If the specified package is not present in a workspace, <code>go get</code>
|
||||
will place it inside the first workspace specified by <code>GOPATH</code>.
|
||||
(If the package does already exist, <code>go get</code> skips the remote
|
||||
fetch and behaves the same as <code>go install</code>.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
After issuing the above <code>go get</code> command, the workspace directory
|
||||
tree should now look like this:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
bin/
|
||||
hello # command executable
|
||||
pkg/
|
||||
linux_amd64/
|
||||
github.com/golang/example/
|
||||
stringutil.a # package object
|
||||
github.com/user/
|
||||
stringutil.a # package object
|
||||
src/
|
||||
github.com/golang/example/
|
||||
.git/ # Git repository metadata
|
||||
hello/
|
||||
hello.go # command source
|
||||
stringutil/
|
||||
reverse.go # package source
|
||||
reverse_test.go # test source
|
||||
github.com/user/
|
||||
hello/
|
||||
hello.go # command source
|
||||
stringutil/
|
||||
reverse.go # package source
|
||||
reverse_test.go # test source
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The <code>hello</code> command hosted at GitHub depends on the
|
||||
<code>stringutil</code> package within the same repository. The imports in
|
||||
<code>hello.go</code> file use the same import path convention, so the
|
||||
<code>go get</code> command is able to locate and install the dependent
|
||||
package, too.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
import "github.com/golang/example/stringutil"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This convention is the easiest way to make your Go packages available for
|
||||
others to use.
|
||||
The <a href="//golang.org/wiki/Projects">Go Wiki</a>
|
||||
and <a href="//godoc.org/">godoc.org</a>
|
||||
provide lists of external Go projects.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For more information on using remote repositories with the <code>go</code> tool, see
|
||||
<code><a href="/cmd/go/#hdr-Remote_import_paths">go help importpath</a></code>.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="next">What's next</h2>
|
||||
|
||||
<p>
|
||||
Subscribe to the
|
||||
<a href="//groups.google.com/group/golang-announce">golang-announce</a>
|
||||
mailing list to be notified when a new stable version of Go is released.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
See <a href="/doc/effective_go.html">Effective Go</a> for tips on writing
|
||||
clear, idiomatic Go code.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Take <a href="//tour.golang.org/">A Tour of Go</a> to learn the language
|
||||
proper.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Visit the <a href="/doc/#articles">documentation page</a> for a set of in-depth
|
||||
articles about the Go language and its libraries and tools.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="help">Getting help</h2>
|
||||
|
||||
<p>
|
||||
For real-time help, ask the helpful gophers in <code>#go-nuts</code> on the
|
||||
<a href="http://freenode.net/">Freenode</a> IRC server.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The official mailing list for discussion of the Go language is
|
||||
<a href="//groups.google.com/group/golang-nuts">Go Nuts</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Report bugs using the
|
||||
<a href="//golang.org/issue">Go issue tracker</a>.
|
||||
</p>
|
||||
<p>The same holds for <code>.s</code> (assembly) files.</p>
|
||||
|
||||
25
doc/codelab/wiki/Makefile
Normal file
25
doc/codelab/wiki/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
include ../../../src/Make.inc
|
||||
|
||||
all: index.html
|
||||
|
||||
include ../../../src/Make.common
|
||||
|
||||
CLEANFILES+=index.html srcextract.bin htmlify.bin get.bin
|
||||
|
||||
index.html: srcextract.bin htmlify.bin
|
||||
PATH=.:$$PATH awk '/^!/{system(substr($$0,2)); next} {print}' < wiki.html | tr -d '\r' > index.html
|
||||
|
||||
test: get.bin
|
||||
bash ./test.sh
|
||||
rm -f get.6 get.bin
|
||||
|
||||
%.bin: %.$O
|
||||
$(LD) -o $@ $<
|
||||
|
||||
%.$O: %.go
|
||||
$(GC) $*.go
|
||||
|
||||
6
doc/codelab/wiki/edit.html
Normal file
6
doc/codelab/wiki/edit.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing {Title}</h1>
|
||||
|
||||
<form action="/save/{Title}" method="POST">
|
||||
<div><textarea name="body" rows="20" cols="80">{Body|html}</textarea></div>
|
||||
<div><input type="submit" value="Save"></div>
|
||||
</form>
|
||||
100
doc/codelab/wiki/final-noclosure.go
Normal file
100
doc/codelab/wiki/final-noclosure.go
Normal file
@@ -0,0 +1,100 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"template"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, os.Error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title, err := getTitle(w, r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/edit/"+title, http.StatusFound)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title, err := getTitle(w, r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title, err := getTitle(w, r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
err = p.save()
|
||||
if err != nil {
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
t, err := template.ParseFile(tmpl+".html", nil)
|
||||
if err != nil {
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
err = t.Execute(w, p)
|
||||
if err != nil {
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
const lenPath = len("/view/")
|
||||
|
||||
var titleValidator = regexp.MustCompile("^[a-zA-Z0-9]+$")
|
||||
|
||||
func getTitle(w http.ResponseWriter, r *http.Request) (title string, err os.Error) {
|
||||
title = r.URL.Path[lenPath:]
|
||||
if !titleValidator.MatchString(title) {
|
||||
http.NotFound(w, r)
|
||||
err = os.NewError("Invalid Page Title")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.HandleFunc("/edit/", editHandler)
|
||||
http.HandleFunc("/save/", saveHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
52
doc/codelab/wiki/final-noerror.go
Normal file
52
doc/codelab/wiki/final-noerror.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"template"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, os.Error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
const lenPath = len("/view/")
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[lenPath:]
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
t, _ := template.ParseFile("edit.html", nil)
|
||||
t.Execute(w, p)
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[lenPath:]
|
||||
p, _ := loadPage(title)
|
||||
t, _ := template.ParseFile("view.html", nil)
|
||||
t.Execute(w, p)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.HandleFunc("/edit/", editHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
90
doc/codelab/wiki/final-parsetemplate.go
Normal file
90
doc/codelab/wiki/final-parsetemplate.go
Normal file
@@ -0,0 +1,90 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"template"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, os.Error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/edit/"+title, http.StatusFound)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
err := p.save()
|
||||
if err != nil {
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
t, err := template.ParseFile(tmpl+".html", nil)
|
||||
if err != nil {
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
err = t.Execute(w, p)
|
||||
if err != nil {
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
const lenPath = len("/view/")
|
||||
|
||||
var titleValidator = regexp.MustCompile("^[a-zA-Z0-9]+$")
|
||||
|
||||
func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[lenPath:]
|
||||
if !titleValidator.MatchString(title) {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
fn(w, r, title)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", makeHandler(viewHandler))
|
||||
http.HandleFunc("/edit/", makeHandler(editHandler))
|
||||
http.HandleFunc("/save/", makeHandler(saveHandler))
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
64
doc/codelab/wiki/final-template.go
Normal file
64
doc/codelab/wiki/final-template.go
Normal file
@@ -0,0 +1,64 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"template"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, os.Error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
const lenPath = len("/view/")
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[lenPath:]
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[lenPath:]
|
||||
p, _ := loadPage(title)
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[lenPath:]
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
p.save()
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
t, _ := template.ParseFile(tmpl+".html", nil)
|
||||
t.Execute(w, p)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.HandleFunc("/edit/", editHandler)
|
||||
http.HandleFunc("/save/", saveHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
93
doc/codelab/wiki/final.go
Normal file
93
doc/codelab/wiki/final.go
Normal file
@@ -0,0 +1,93 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"template"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, os.Error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
http.Redirect(w, r, "/edit/"+title, http.StatusFound)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "view", p)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
}
|
||||
renderTemplate(w, "edit", p)
|
||||
}
|
||||
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
|
||||
body := r.FormValue("body")
|
||||
p := &Page{Title: title, Body: []byte(body)}
|
||||
err := p.save()
|
||||
if err != nil {
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/view/"+title, http.StatusFound)
|
||||
}
|
||||
|
||||
var templates = make(map[string]*template.Template)
|
||||
|
||||
func init() {
|
||||
for _, tmpl := range []string{"edit", "view"} {
|
||||
templates[tmpl] = template.MustParseFile(tmpl+".html", nil)
|
||||
}
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
|
||||
err := templates[tmpl].Execute(w, p)
|
||||
if err != nil {
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
const lenPath = len("/view/")
|
||||
|
||||
var titleValidator = regexp.MustCompile("^[a-zA-Z0-9]+$")
|
||||
|
||||
func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[lenPath:]
|
||||
if !titleValidator.MatchString(title) {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
fn(w, r, title)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", makeHandler(viewHandler))
|
||||
http.HandleFunc("/edit/", makeHandler(editHandler))
|
||||
http.HandleFunc("/save/", makeHandler(saveHandler))
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
50
doc/codelab/wiki/get.go
Normal file
50
doc/codelab/wiki/get.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"http"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
post = flag.String("post", "", "urlencoded form data to POST")
|
||||
addr = flag.Bool("addr", false, "find open address and print to stdout")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if *addr {
|
||||
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer l.Close()
|
||||
fmt.Print(l.Addr())
|
||||
return
|
||||
}
|
||||
url := flag.Arg(0)
|
||||
if url == "" {
|
||||
log.Fatal("no url supplied")
|
||||
}
|
||||
var r *http.Response
|
||||
var err os.Error
|
||||
if *post != "" {
|
||||
b := strings.NewReader(*post)
|
||||
r, err = http.Post(url, "application/x-www-form-urlencoded", b)
|
||||
} else {
|
||||
r, _, err = http.Get(url)
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer r.Body.Close()
|
||||
_, err = io.Copy(os.Stdout, r.Body)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
12
doc/codelab/wiki/htmlify.go
Normal file
12
doc/codelab/wiki/htmlify.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"template"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
b, _ := ioutil.ReadAll(os.Stdin)
|
||||
template.HTMLFormatter(os.Stdout, "", b)
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"http"
|
||||
)
|
||||
|
||||
func handler(w http.ResponseWriter, r *http.Request) {
|
||||
1003
doc/codelab/wiki/index.html
Normal file
1003
doc/codelab/wiki/index.html
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,10 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"http"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
@@ -15,12 +12,12 @@ type Page struct {
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() error {
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, error) {
|
||||
func loadPage(title string) (*Page, os.Error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
@@ -29,14 +26,16 @@ func loadPage(title string) (*Page, error) {
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
const lenPath = len("/view/")
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/view/"):]
|
||||
title := r.URL.Path[lenPath:]
|
||||
p, _ := loadPage(title)
|
||||
fmt.Fprintf(w, "<h1>%s</h1><div>%s</div>", p.Title, p.Body)
|
||||
}
|
||||
|
||||
func editHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[len("/edit/"):]
|
||||
title := r.URL.Path[lenPath:]
|
||||
p, err := loadPage(title)
|
||||
if err != nil {
|
||||
p = &Page{Title: title}
|
||||
30
doc/codelab/wiki/part1-noerror.go
Normal file
30
doc/codelab/wiki/part1-noerror.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) *Page {
|
||||
filename := title + ".txt"
|
||||
body, _ := ioutil.ReadFile(filename)
|
||||
return &Page{Title: title, Body: body}
|
||||
}
|
||||
|
||||
func main() {
|
||||
p1 := &Page{Title: "TestPage", Body: []byte("This is a sample page.")}
|
||||
p1.save()
|
||||
p2 := loadPage("TestPage")
|
||||
fmt.Println(string(p2.Body))
|
||||
}
|
||||
33
doc/codelab/wiki/part1.go
Normal file
33
doc/codelab/wiki/part1.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, os.Error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
p1 := &Page{Title: "TestPage", Body: []byte("This is a sample Page.")}
|
||||
p1.save()
|
||||
p2, _ := loadPage("TestPage")
|
||||
fmt.Println(string(p2.Body))
|
||||
}
|
||||
40
doc/codelab/wiki/part2.go
Normal file
40
doc/codelab/wiki/part2.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Page struct {
|
||||
Title string
|
||||
Body []byte
|
||||
}
|
||||
|
||||
func (p *Page) save() os.Error {
|
||||
filename := p.Title + ".txt"
|
||||
return ioutil.WriteFile(filename, p.Body, 0600)
|
||||
}
|
||||
|
||||
func loadPage(title string) (*Page, os.Error) {
|
||||
filename := title + ".txt"
|
||||
body, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Page{Title: title, Body: body}, nil
|
||||
}
|
||||
|
||||
const lenPath = len("/view/")
|
||||
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
title := r.URL.Path[lenPath:]
|
||||
p, _ := loadPage(title)
|
||||
fmt.Fprintf(w, "<h1>%s</h1><div>%s</div>", p.Title, p.Body)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/view/", viewHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
72
doc/codelab/wiki/srcextract.go
Normal file
72
doc/codelab/wiki/srcextract.go
Normal file
@@ -0,0 +1,72 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"go/parser"
|
||||
"go/printer"
|
||||
"go/ast"
|
||||
"go/token"
|
||||
"log"
|
||||
"os"
|
||||
"template"
|
||||
)
|
||||
|
||||
var (
|
||||
srcFn = flag.String("src", "", "source filename")
|
||||
getName = flag.String("name", "", "func/type name to output")
|
||||
html = flag.Bool("html", true, "output HTML")
|
||||
showPkg = flag.Bool("pkg", false, "show package in output")
|
||||
)
|
||||
|
||||
func main() {
|
||||
// handle input
|
||||
flag.Parse()
|
||||
if *srcFn == "" || *getName == "" {
|
||||
flag.Usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
// load file
|
||||
fs := token.NewFileSet()
|
||||
file, err := parser.ParseFile(fs, *srcFn, nil, 0)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// create filter
|
||||
filter := func(name string) bool {
|
||||
return name == *getName
|
||||
}
|
||||
// filter
|
||||
if !ast.FilterFile(file, filter) {
|
||||
os.Exit(1)
|
||||
}
|
||||
// print the AST
|
||||
var b bytes.Buffer
|
||||
printer.Fprint(&b, fs, file)
|
||||
// drop package declaration
|
||||
if !*showPkg {
|
||||
for {
|
||||
c, err := b.ReadByte()
|
||||
if c == '\n' || err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// drop leading newlines
|
||||
for {
|
||||
b, err := b.ReadByte()
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
if b != '\n' {
|
||||
os.Stdout.Write([]byte{b})
|
||||
break
|
||||
}
|
||||
}
|
||||
// output
|
||||
if *html {
|
||||
template.HTMLEscape(os.Stdout, b.Bytes())
|
||||
} else {
|
||||
b.WriteTo(os.Stdout)
|
||||
}
|
||||
}
|
||||
27
doc/codelab/wiki/test.sh
Executable file
27
doc/codelab/wiki/test.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
wiki_pid=
|
||||
cleanup() {
|
||||
kill $wiki_pid
|
||||
rm -f test_*.out Test.txt final-test.bin final-test.go
|
||||
}
|
||||
trap cleanup 0 INT
|
||||
|
||||
gomake get.bin
|
||||
addr=$(./get.bin -addr)
|
||||
sed s/:8080/$addr/ < final.go > final-test.go
|
||||
gomake final-test.bin
|
||||
(./final-test.bin) &
|
||||
wiki_pid=$!
|
||||
|
||||
sleep 1
|
||||
|
||||
./get.bin http://$addr/edit/Test > test_edit.out
|
||||
diff -u test_edit.out test_edit.good
|
||||
./get.bin -post=body=some%20content http://$addr/save/Test
|
||||
diff -u Test.txt test_Test.txt.good
|
||||
./get.bin http://$addr/view/Test > test_view.out
|
||||
diff -u test_view.out test_view.good
|
||||
|
||||
echo PASS
|
||||
5
doc/codelab/wiki/view.html
Normal file
5
doc/codelab/wiki/view.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>{Title}</h1>
|
||||
|
||||
<p>[<a href="/edit/{Title}">edit</a>]</p>
|
||||
|
||||
<div>{Body}</div>
|
||||
781
doc/codelab/wiki/wiki.html
Normal file
781
doc/codelab/wiki/wiki.html
Normal file
@@ -0,0 +1,781 @@
|
||||
<!-- Codelab: Writing Web Applications -->
|
||||
<h2>Introduction</h2>
|
||||
|
||||
<p>
|
||||
Covered in this codelab:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Creating a data structure with load and save methods</li>
|
||||
<li>Using the <code>http</code> package to build web applications
|
||||
<li>Using the <code>template</code> package to process HTML templates</li>
|
||||
<li>Using the <code>regexp</code> package to validate user input</li>
|
||||
<li>Using closures</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Assumed knowledge:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Programming experience</li>
|
||||
<li>Understanding of basic web technologies (HTTP, HTML)</li>
|
||||
<li>Some UNIX command-line knowledge</li>
|
||||
</ul>
|
||||
|
||||
<h2>Getting Started</h2>
|
||||
|
||||
<p>
|
||||
At present, you need to have a Linux, OS X, or FreeBSD machine to run Go. If
|
||||
you don't have access to one, you could set up a Linux Virtual Machine (using
|
||||
<a href="http://www.virtualbox.org/">VirtualBox</a> or similar) or a
|
||||
<a href="http://www.google.com/search?q=virtual+private+server">Virtual
|
||||
Private Server</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Install Go (see the <a href="http://golang.org/doc/install.html">Installation Instructions</a>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Make a new directory for this codelab and cd to it:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ mkdir ~/gowiki
|
||||
$ cd ~/gowiki
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Create a file named <code>wiki.go</code>, open it in your favorite editor, and
|
||||
add the following lines:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
We import the <code>fmt</code>, <code>ioutil</code> and <code>os</code>
|
||||
packages from the Go standard library. Later, as we implement additional
|
||||
functionality, we will add more packages to this <code>import</code>
|
||||
declaration.
|
||||
</p>
|
||||
|
||||
<h2>Data Structures</h2>
|
||||
|
||||
<p>
|
||||
Let's start by defining the data structures. A wiki consists of a series of
|
||||
interconnected pages, each of which has a title and a body (the page content).
|
||||
Here, we define <code>Page</code> as a struct with two fields representing
|
||||
the title and body.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=part1.go -name=Page
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The type <code>[]byte</code> means "a <code>byte</code> slice".
|
||||
(See <a href="http://golang.org/doc/effective_go.html#slices">Effective Go</a>
|
||||
for more on slices.)
|
||||
The <code>Body</code> element is a <code>[]byte</code> rather than
|
||||
<code>string</code> because that is the type expected by the <code>io</code>
|
||||
libraries we will use, as you'll see below.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>Page</code> struct describes how page data will be stored in memory.
|
||||
But what about persistent storage? We can address that by creating a
|
||||
<code>save</code> method on <code>Page</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=part1.go -name=save
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This method's signature reads: "This is a method named <code>save</code> that
|
||||
takes as its receiver <code>p</code>, a pointer to <code>Page</code> . It takes
|
||||
no parameters, and returns a value of type <code>os.Error</code>."
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This method will save the <code>Page</code>'s <code>Body</code> to a text
|
||||
file. For simplicity, we will use the <code>Title</code> as the file name.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>save</code> method returns an <code>os.Error</code> value because
|
||||
that is the return type of <code>WriteFile</code> (a standard library function
|
||||
that writes a byte slice to a file). The <code>save</code> method returns the
|
||||
error value, to let the application handle it should anything go wrong while
|
||||
writing the file. If all goes well, <code>Page.save()</code> will return
|
||||
<code>nil</code> (the zero-value for pointers, interfaces, and some other
|
||||
types).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The octal integer constant <code>0600</code>, passed as the third parameter to
|
||||
<code>WriteFile</code>, indicates that the file should be created with
|
||||
read-write permissions for the current user only. (See the Unix man page
|
||||
<code>open(2)</code> for details.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We will want to load pages, too:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=part1-noerror.go -name=loadPage
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The function <code>loadPage</code> constructs the file name from
|
||||
<code>Title</code>, reads the file's contents into a new
|
||||
<code>Page</code>, and returns a pointer to that new <code>page</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Functions can return multiple values. The standard library function
|
||||
<code>io.ReadFile</code> returns <code>[]byte</code> and <code>os.Error</code>.
|
||||
In <code>loadPage</code>, error isn't being handled yet; the "blank identifier"
|
||||
represented by the underscore (<code>_</code>) symbol is used to throw away the
|
||||
error return value (in essence, assigning the value to nothing).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
But what happens if <code>ReadFile</code> encounters an error? For example,
|
||||
the file might not exist. We should not ignore such errors. Let's modify the
|
||||
function to return <code>*Page</code> and <code>os.Error</code>.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=part1.go -name=loadPage
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Callers of this function can now check the second parameter; if it is
|
||||
<code>nil</code> then it has successfully loaded a Page. If not, it will be an
|
||||
<code>os.Error</code> that can be handled by the caller (see the <a
|
||||
href="http://golang.org/pkg/os/#Error">os package documentation</a> for
|
||||
details).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
At this point we have a simple data structure and the ability to save to and
|
||||
load from a file. Let's write a <code>main</code> function to test what we've
|
||||
written:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=part1.go -name=main
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
After compiling and executing this code, a file named <code>TestPage.txt</code>
|
||||
would be created, containing the contents of <code>p1</code>. The file would
|
||||
then be read into the struct <code>p2</code>, and its <code>Body</code> element
|
||||
printed to the screen.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can compile and run the program like this:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ 8g wiki.go
|
||||
$ 8l wiki.8
|
||||
$ ./8.out
|
||||
This is a sample page.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
(The <code>8g</code> and <code>8l</code> commands are applicable to
|
||||
<code>GOARCH=386</code>. If you're on an <code>amd64</code> system,
|
||||
substitute 6's for the 8's.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="part1.go">Click here to view the code we've written so far.</a>
|
||||
</p>
|
||||
|
||||
<h2>Introducing the <code>http</code> package (an interlude)</h2>
|
||||
|
||||
<p>
|
||||
Here's a full working example of a simple web server:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!htmlify.bin < http-sample.go
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The <code>main</code> function begins with a call to
|
||||
<code>http.HandleFunc</code>, which tells the <code>http</code> package to
|
||||
handle all requests to the web root (<code>"/"</code>) with
|
||||
<code>handler</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It then calls <code>http.ListenAndServe</code>, specifying that it should
|
||||
listen on port 8080 on any interface (<code>":8080"</code>). (Don't
|
||||
worry about its second parameter, <code>nil</code>, for now.)
|
||||
This function will block until the program is terminated.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The function <code>handler</code> is of the type <code>http.HandlerFunc</code>.
|
||||
It takes an <code>http.ResponseWriter</code> and an <code>http.Request</code> as
|
||||
its arguments.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
An <code>http.ResponseWriter</code> value assembles the HTTP server's response; by writing
|
||||
to it, we send data to the HTTP client.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
An <code>http.Request</code> is a data structure that represents the client
|
||||
HTTP request. The string <code>r.URL.Path</code> is the path component
|
||||
of the request URL. The trailing <code>[1:]</code> means
|
||||
"create a sub-slice of <code>Path</code> from the 1st character to the end."
|
||||
This drops the leading "/" from the path name.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you run this program and access the URL:
|
||||
</p>
|
||||
<pre>http://localhost:8080/monkeys</pre>
|
||||
<p>
|
||||
the program would present a page containing:
|
||||
</p>
|
||||
<pre>Hi there, I love monkeys!</pre>
|
||||
|
||||
<h2>Using <code>http</code> to serve wiki pages</h2>
|
||||
|
||||
<p>
|
||||
To use the <code>http</code> package, it must be imported:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
import (
|
||||
"fmt"
|
||||
<b>"http"</b>
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Let's create a handler to view a wiki page:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=part2.go -name=lenPath
|
||||
|
||||
!srcextract.bin -src=part2.go -name=viewHandler
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
First, this function extracts the page title from <code>r.URL.Path</code>,
|
||||
the path component of the request URL. The global constant
|
||||
<code>lenPath</code> is the length of the leading <code>"/view/"</code>
|
||||
component of the request path.
|
||||
The <code>Path</code> is re-sliced with <code>[lenPath:]</code> to drop the
|
||||
first 6 characters of the string. This is because the path will invariably
|
||||
begin with <code>"/view/"</code>, which is not part of the page title.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The function then loads the page data, formats the page with a string of simple
|
||||
HTML, and writes it to <code>w</code>, the <code>http.ResponseWriter</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Again, note the use of <code>_</code> to ignore the <code>os.Error</code>
|
||||
return value from <code>loadPage</code>. This is done here for simplicity
|
||||
and generally considered bad practice. We will attend to this later.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To use this handler, we create a <code>main</code> function that
|
||||
initializes <code>http</code> using the <code>viewHandler</code> to handle
|
||||
any requests under the path <code>/view/</code>.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=part2.go -name=main
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<a href="part2.go">Click here to view the code we've written so far.</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Let's create some page data (as <code>test.txt</code>), compile our code, and
|
||||
try serving a wiki page:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ echo "Hello world" > test.txt
|
||||
$ 8g wiki.go
|
||||
$ 8l wiki.8
|
||||
$ ./8.out
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
With this web server running, a visit to <code><a
|
||||
href="http://localhost:8080/view/test">http://localhost:8080/view/test</a></code>
|
||||
should show a page titled "test" containing the words "Hello world".
|
||||
</p>
|
||||
|
||||
<h2>Editing Pages</h2>
|
||||
|
||||
<p>
|
||||
A wiki is not a wiki without the ability to edit pages. Let's create two new
|
||||
handlers: one named <code>editHandler</code> to display an 'edit page' form,
|
||||
and the other named <code>saveHandler</code> to save the data entered via the
|
||||
form.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, we add them to <code>main()</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-noclosure.go -name=main
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The function <code>editHandler</code> loads the page
|
||||
(or, if it doesn't exist, create an empty <code>Page</code> struct),
|
||||
and displays an HTML form.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=notemplate.go -name=editHandler
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This function will work fine, but all that hard-coded HTML is ugly.
|
||||
Of course, there is a better way.
|
||||
</p>
|
||||
|
||||
<h2>The <code>template</code> package</h2>
|
||||
|
||||
<p>
|
||||
The <code>template</code> package is part of the Go standard library. We can
|
||||
use <code>template</code> to keep the HTML in a separate file, allowing
|
||||
us to change the layout of our edit page without modifying the underlying Go
|
||||
code.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, we must add <code>template</code> to the list of imports:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
import (
|
||||
"http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
<b>"template"</b>
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Let's create a template file containing the HTML form.
|
||||
Open a new file named <code>edit.html</code>, and add the following lines:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!htmlify.bin < edit.html
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Modify <code>editHandler</code> to use the template, instead of the hard-coded
|
||||
HTML:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-noerror.go -name=editHandler
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The function <code>template.ParseFile</code> will read the contents of
|
||||
<code>edit.html</code> and return a <code>*template.Template</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The method <code>t.Execute</code> replaces all occurrences of
|
||||
<code>{Title}</code> and <code>{Body}</code> with the values of
|
||||
<code>p.Title</code> and <code>p.Body</code>, and writes the resultant
|
||||
HTML to the <code>http.ResponseWriter</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that we've used <code>{Body|html}</code> in the above template.
|
||||
The <code>|html</code> part asks the template engine to pass the value
|
||||
<code>Body</code> through the <code>html</code> formatter before outputting it,
|
||||
which escapes HTML characters (such as replacing <code>></code> with
|
||||
<code>&gt;</code>).
|
||||
This will prevent user data from corrupting the form HTML.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now that we've removed the <code>fmt.Sprintf</code> statement, we can remove
|
||||
<code>"fmt"</code> from the <code>import</code> list.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
While we're working with templates, let's create a template for our
|
||||
<code>viewHandler</code> called <code>view.html</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!htmlify.bin < view.html
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Modify <code>viewHandler</code> accordingly:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-noerror.go -name=viewHandler
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Notice that we've used almost exactly the same templating code in both
|
||||
handlers. Let's remove this duplication by moving the templating code
|
||||
to its own function:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-template.go -name=viewHandler
|
||||
|
||||
!srcextract.bin -src=final-template.go -name=editHandler
|
||||
|
||||
!srcextract.bin -src=final-template.go -name=renderTemplate
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The handlers are now shorter and simpler.
|
||||
</p>
|
||||
|
||||
<h2>Handling non-existent pages</h2>
|
||||
|
||||
<p>
|
||||
What if you visit <code>/view/APageThatDoesntExist</code>? The program will
|
||||
crash. This is because it ignores the error return value from
|
||||
<code>loadPage</code>. Instead, if the requested Page doesn't exist, it should
|
||||
redirect the client to the edit Page so the content may be created:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-noclosure.go -name=viewHandler
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The <code>http.Redirect</code> function adds an HTTP status code of
|
||||
<code>http.StatusFound</code> (302) and a <code>Location</code>
|
||||
header to the HTTP response.
|
||||
</p>
|
||||
|
||||
<h2>Saving Pages</h2>
|
||||
|
||||
<p>
|
||||
The function <code>saveHandler</code> will handle the form submission.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-template.go -name=saveHandler
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The page title (provided in the URL) and the form's only field,
|
||||
<code>Body</code>, are stored in a new <code>Page</code>.
|
||||
The <code>save()</code> method is then called to write the data to a file,
|
||||
and the client is redirected to the <code>/view/</code> page.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The value returned by <code>FormValue</code> is of type <code>string</code>.
|
||||
We must convert that value to <code>[]byte</code> before it will fit into
|
||||
the <code>Page</code> struct. We use <code>[]byte(body)</code> to perform
|
||||
the conversion.
|
||||
</p>
|
||||
|
||||
<h2>Error handling</h2>
|
||||
|
||||
<p>
|
||||
There are several places in our program where errors are being ignored. This
|
||||
is bad practice, not least because when an error does occur the program will
|
||||
crash. A better solution is to handle the errors and return an error message
|
||||
to the user. That way if something does go wrong, the server will continue to
|
||||
function and the user will be notified.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, let's handle the errors in <code>renderTemplate</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-parsetemplate.go -name=renderTemplate
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The <code>http.Error</code> function sends a specified HTTP response code
|
||||
(in this case "Internal Server Error") and error message.
|
||||
Already the decision to put this in a separate function is paying off.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now let's fix up <code>saveHandler</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-noclosure.go -name=saveHandler
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Any errors that occur during <code>p.save()</code> will be reported
|
||||
to the user.
|
||||
</p>
|
||||
|
||||
<h2>Template caching</h2>
|
||||
|
||||
<p>
|
||||
There is an inefficiency in this code: <code>renderTemplate</code> calls
|
||||
<code>ParseFile</code> every time a page is rendered.
|
||||
A better approach would be to call <code>ParseFile</code> once for each
|
||||
template at program initialization, and store the resultant
|
||||
<code>*Template</code> values in a data structure for later use.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First we create a global map named <code>templates</code> in which to store
|
||||
our <code>*Template</code> values, keyed by <code>string</code>
|
||||
(the template name):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final.go -name=templates
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Then we create an <code>init</code> function, which will be called before
|
||||
<code>main</code> at program initialization. The function
|
||||
<code>template.MustParseFile</code> is a convenience wrapper around
|
||||
<code>ParseFile</code> that does not return an error code; instead, it panics
|
||||
if an error is encountered. A panic is appropriate here; if the templates can't
|
||||
be loaded the only sensible thing to do is exit the program.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final.go -name=init
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
A <code>for</code> loop is used with a <code>range</code> statement to iterate
|
||||
over an array constant containing the names of the templates we want parsed.
|
||||
If we were to add more templates to our program, we would add their names to
|
||||
that array.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We then modify our <code>renderTemplate</code> function to call
|
||||
the <code>Execute</code> method on the appropriate <code>Template</code> from
|
||||
<code>templates</code>:
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final.go -name=renderTemplate
|
||||
</pre>
|
||||
|
||||
<h2>Validation</h2>
|
||||
|
||||
<p>
|
||||
As you may have observed, this program has a serious security flaw: a user
|
||||
can supply an arbitrary path to be read/written on the server. To mitigate
|
||||
this, we can write a function to validate the title with a regular expression.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, add <code>"regexp"</code> to the <code>import</code> list.
|
||||
Then we can create a global variable to store our validation regexp:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-noclosure.go -name=titleValidator
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The function <code>regexp.MustCompile</code> will parse and compile the
|
||||
regular expression, and return a <code>regexp.Regexp</code>.
|
||||
<code>MustCompile</code>, like <code>template.MustParseFile</code>,
|
||||
is distinct from <code>Compile</code> in that it will panic if
|
||||
the expression compilation fails, while <code>Compile</code> returns an
|
||||
<code>os.Error</code> as a second parameter.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now, let's write a function that extracts the title string from the request
|
||||
URL, and tests it against our <code>TitleValidator</code> expression:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-noclosure.go -name=getTitle
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If the title is valid, it will be returned along with a <code>nil</code>
|
||||
error value. If the title is invalid, the function will write a
|
||||
"404 Not Found" error to the HTTP connection, and return an error to the
|
||||
handler.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Let's put a call to <code>getTitle</code> in each of the handlers:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final-noclosure.go -name=viewHandler
|
||||
|
||||
!srcextract.bin -src=final-noclosure.go -name=editHandler
|
||||
|
||||
!srcextract.bin -src=final-noclosure.go -name=saveHandler
|
||||
</pre>
|
||||
|
||||
<h2>Introducing Function Literals and Closures</h2>
|
||||
|
||||
<p>
|
||||
Catching the error condition in each handler introduces a lot of repeated code.
|
||||
What if we could wrap each of the handlers in a function that does this
|
||||
validation and error checking? Go's
|
||||
<a href="http://golang.org/doc/go_spec.html#Function_declarations">function
|
||||
literals</a> provide a powerful means of abstracting functionality
|
||||
that can help us here.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
First, we re-write the function definition of each of the handlers to accept
|
||||
a title string:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request, title string)
|
||||
func editHandler(w http.ResponseWriter, r *http.Request, title string)
|
||||
func saveHandler(w http.ResponseWriter, r *http.Request, title string)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Now let's define a wrapper function that <i>takes a function of the above
|
||||
type</i>, and returns a function of type <code>http.HandlerFunc</code>
|
||||
(suitable to be passed to the function <code>http.HandleFunc</code>):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
func makeHandler(fn func (http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
// Here we will extract the page title from the Request,
|
||||
// and call the provided handler 'fn'
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The returned function is called a closure because it encloses values defined
|
||||
outside of it. In this case, the variable <code>fn</code> (the single argument
|
||||
to <code>makeHandler</code>) is enclosed by the closure. The variable
|
||||
<code>fn</code> will be one of our save, edit, or view handlers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now we can take the code from <code>getTitle</code> and use it here
|
||||
(with some minor modifications):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final.go -name=makeHandler
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The closure returned by <code>makeHandler</code> is a function that takes
|
||||
an <code>http.ResponseWriter</code> and <code>http.Request</code> (in other
|
||||
words, an <code>http.HandlerFunc</code>).
|
||||
The closure extracts the <code>title</code> from the request path, and
|
||||
validates it with the <code>TitleValidator</code> regexp. If the
|
||||
<code>title</code> is invalid, an error will be written to the
|
||||
<code>ResponseWriter</code> using the <code>http.NotFound</code> function.
|
||||
If the <code>title</code> is valid, the enclosed handler function
|
||||
<code>fn</code> will be called with the <code>ResponseWriter</code>,
|
||||
<code>Request</code>, and <code>title</code> as arguments.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now we can wrap the handler functions with <code>makeHandler</code> in
|
||||
<code>main</code>, before they are registered with the <code>http</code>
|
||||
package:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final.go -name=main
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Finally we remove the calls to <code>getTitle</code> from the handler functions,
|
||||
making them much simpler:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
!srcextract.bin -src=final.go -name=viewHandler
|
||||
|
||||
!srcextract.bin -src=final.go -name=editHandler
|
||||
|
||||
!srcextract.bin -src=final.go -name=saveHandler
|
||||
</pre>
|
||||
|
||||
<h2>Try it out!</h2>
|
||||
|
||||
<p>
|
||||
<a href="final.go">Click here to view the final code listing.</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Recompile the code, and run the app:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ 8g wiki.go
|
||||
$ 8l wiki.8
|
||||
$ ./8.out
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Visiting <a href="http://localhost:8080/view/ANewPage">http://localhost:8080/view/ANewPage</a>
|
||||
should present you with the page edit form. You should then be able to
|
||||
enter some text, click 'Save', and be redirected to the newly created page.
|
||||
</p>
|
||||
|
||||
<h2>Other tasks</h2>
|
||||
|
||||
<p>
|
||||
Here are some simple tasks you might want to tackle on your own:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Store templates in <code>tmpl/</code> and page data in <code>data/</code>.
|
||||
<li>Add a handler to make the web root redirect to
|
||||
<code>/view/FrontPage</code>.</li>
|
||||
<li>Spruce up the page templates by making them valid HTML and adding some
|
||||
CSS rules.</li>
|
||||
<li>Implement inter-page linking by converting instances of
|
||||
<code>[PageName]</code> to <br>
|
||||
<code><a href="/view/PageName">PageName</a></code>.
|
||||
(hint: you could use <code>regexp.ReplaceAllFunc</code> to do this)
|
||||
</li>
|
||||
</ul>
|
||||
113
doc/codereview_with_mq.html
Normal file
113
doc/codereview_with_mq.html
Normal file
@@ -0,0 +1,113 @@
|
||||
<!-- Using Mercurial Queues with Codereview -->
|
||||
|
||||
<h2 id="Introduction">Introduction</h2>
|
||||
|
||||
<p>
|
||||
The Mercurial Queues extension (<code>mq</code>) provides a mechanism for
|
||||
managing patches on top of a Mercurial repository and is described in detail
|
||||
in Chapters
|
||||
<a href="http://hgbook.red-bean.com/read/managing-change-with-mercurial-queues.html">12</a>
|
||||
and <a href="http://hgbook.red-bean.com/read/advanced-uses-of-mercurial-queues.html">13</a>
|
||||
of <a href="http://hgbook.red-bean.com/read/">Mercurial: The Definitive Guide</a>.
|
||||
This document explains how to use <code>mq</code> in conjunction
|
||||
with the <code>codereview</code> Mercurial extension described in the
|
||||
instructions for <a href="contribute.html">contributing to the Go project</a>.
|
||||
It assumes you have read those instructions.
|
||||
</p>
|
||||
|
||||
<h2>Configuration</h2>
|
||||
|
||||
<p>
|
||||
To enable <code>mq</code> edit either <code>$HOME/.hgrc</code> (to enable it
|
||||
for all of your repositories) or <code>$GOROOT/.hg/hgrc</code> (to enable it for the
|
||||
repository at <code>$GOROOT</code>) to add:</p>
|
||||
|
||||
<pre>
|
||||
[extensions]
|
||||
mq=
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Since pulling, pushing, updating and committing while <code>mq</code> patches
|
||||
are applied can damage your repository or a remote one, add these lines to
|
||||
prevent that case:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
[hooks]
|
||||
# Prevent "hg pull" if MQ patches are applied.
|
||||
prechangegroup.mq-no-pull = ! hg qtop > /dev/null 2>&1
|
||||
# Prevent "hg push" if MQ patches are applied.
|
||||
preoutgoing.mq-no-push = ! hg qtop > /dev/null 2>&1
|
||||
# Prevent "hg update" if MQ patches are applied.
|
||||
preupdate.mq-no-update = ! hg qtop > /dev/null 2>&1
|
||||
</pre>
|
||||
|
||||
<h2>Making a change</h2>
|
||||
|
||||
<p>
|
||||
The entire checked-out tree is writable and you can use <code>mq</code>,
|
||||
as documented in Chapter
|
||||
<a href="http://hgbook.red-bean.com/read/managing-change-with-mercurial-queues.html">12</a>
|
||||
of "The Guide",
|
||||
to implement your change as a single patch or a series of patches.
|
||||
|
||||
</p>
|
||||
|
||||
<p>When you are ready to send a change out for review, run</p>
|
||||
|
||||
<pre>
|
||||
$ hg change
|
||||
</pre>
|
||||
|
||||
<p>from any directory in your Go repository with all of the <code>mq</code> patches relevant to your
|
||||
change applied and then proceed as instructed in <a href="contribute.html">contributing
|
||||
to the Go project</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The change number reported by <code>hg change</code>, preceded by a <code>+</code>,
|
||||
can be used as an <code>mq</code> patch guard to assist in controlling which patches
|
||||
are applied as described in Chapter
|
||||
<a href="http://hgbook.red-bean.com/read/advanced-uses-of-mercurial-queues.html">13</a>
|
||||
of "The Guide".
|
||||
For example, the command:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
for p in $(hg qapplied); do hg qguard $p +99999; done
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
will apply the guard <code>+99999</code> guard to all currently applied <code>mq</code>
|
||||
patches.
|
||||
</p>
|
||||
|
||||
<h2>Synchronizing your client</h2>
|
||||
|
||||
<p>While you were working, others might have submitted changes
|
||||
to the repository and, as explained in <a href="contribute.html">contributing
|
||||
to the Go project</a>, it is necessary to synchronize your repository using
|
||||
<code>hg sync</code>before sending your change list for review.
|
||||
Because <code>hg sync</code> runs <code>hg pull -u</code>,
|
||||
you should not run <code>hg sync</code> while <code>mq</code> patches are
|
||||
applied. Instead
|
||||
pop all your patches before running <code>hg sync</code> and reapply them after
|
||||
it has completed.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When reapplying the patches, you may need to resolve conflicts
|
||||
as described in <a href="contribute.html">contributing to the Go project</a>.
|
||||
</p>
|
||||
|
||||
<h2>Mailing the change for review</h2>
|
||||
|
||||
<p>
|
||||
You should have all of the <code>mq</code> patches relevant to your
|
||||
change applied when you run <code>hg mail</code>.
|
||||
|
||||
<h2>Submitting the change after the review</h2>
|
||||
|
||||
If you are a committer, you should have all of the <code>mq</code> patches relevant to your
|
||||
change applied when you run <code>hg commit</code>.
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@@ -296,8 +296,8 @@ CodewalkViewer.prototype.updateHeight = function() {
|
||||
this.sizer.height(codeHeight);
|
||||
};
|
||||
|
||||
window.initFuncs.push(function() {
|
||||
var viewer = new CodewalkViewer(jQuery('#codewalk-main'));
|
||||
jQuery(document).ready(function() {
|
||||
var viewer = new CodewalkViewer(jQuery());
|
||||
viewer.selectFirstComment();
|
||||
viewer.targetCommentLinksAtBlank();
|
||||
viewer.installEventHandlers();
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
its <code>src</code> is just a file name.
|
||||
</step>
|
||||
|
||||
<step title="Specifying a source line" src='doc/codewalk/codewalk.xml:/title="Title"/'>
|
||||
<step title="Specifiying a source line" src='doc/codewalk/codewalk.xml:/title="Title"/'>
|
||||
The most complex part of the codewalk specification is
|
||||
saying what lines to highlight.
|
||||
Instead of ordinary line numbers,
|
||||
@@ -91,7 +91,7 @@
|
||||
|
||||
The full address syntax is summarized in this table
|
||||
(an excerpt of Table II from
|
||||
<a href="https://9p.io/sys/doc/sam/sam.html">The text editor <code>sam</code></a>):
|
||||
<a href="http://plan9.bell-labs.com/sys/doc/sam/sam.html">The text editor <code>sam</code></a>):
|
||||
<br/><br/>
|
||||
|
||||
<table>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
turn.
|
||||
</step>
|
||||
|
||||
<step title="Multiple return values" src="doc/codewalk/pig.go:/\/\/ roll returns/,/true\n}/">
|
||||
<step title="Multiple return values" src="doc/codewalk/pig.go:/\/\/ roll returns/,/stay.*true\n}/">
|
||||
Go functions can return multiple values.
|
||||
<br/><br/>
|
||||
|
||||
@@ -82,6 +82,16 @@
|
||||
associated with the current player.
|
||||
</step>
|
||||
|
||||
<step title="Comparing functions" src="doc/codewalk/pig.go:/if action/,/currentPlayer\)\)\n\t\t}/">
|
||||
Functions can be compared for equality in Go. From the
|
||||
<a href="http://golang.org/doc/go_spec.html#Comparison_operators">language specification</a>:
|
||||
Function values are equal if they refer to the same function or if both are <code>nil</code>.
|
||||
<br/><br/>
|
||||
|
||||
We enforce that a <code>strategy</code> function can only return a legal
|
||||
<code>action</code>: either <code>roll</code> or <code>stay</code>.
|
||||
</step>
|
||||
|
||||
<step title="Simulating a tournament" src="doc/codewalk/pig.go:/\/\/ roundRobin/,/gamesPerStrategy\n}/">
|
||||
The <code>roundRobin</code> function simulates a tournament and tallies wins.
|
||||
Each strategy plays each other strategy <code>gamesPerSeries</code> times.
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
/*
|
||||
Generating random text: a Markov chain algorithm
|
||||
|
||||
Based on the program presented in the "Design and Implementation" chapter
|
||||
of The Practice of Programming (Kernighan and Pike, Addison-Wesley 1999).
|
||||
See also Computer Recreations, Scientific American 260, 122 - 125 (1989).
|
||||
|
||||
A Markov chain algorithm generates text by creating a statistical model of
|
||||
potential textual suffixes for a given prefix. Consider this text:
|
||||
|
||||
I am not a number! I am a free man!
|
||||
|
||||
Our Markov chain algorithm would arrange this text into this set of prefixes
|
||||
and suffixes, or "chain": (This table assumes a prefix length of two words.)
|
||||
|
||||
Prefix Suffix
|
||||
|
||||
"" "" I
|
||||
"" I am
|
||||
I am a
|
||||
I am not
|
||||
a free man!
|
||||
am a free
|
||||
am not a
|
||||
a number! I
|
||||
number! I am
|
||||
not a number!
|
||||
|
||||
To generate text using this table we select an initial prefix ("I am", for
|
||||
example), choose one of the suffixes associated with that prefix at random
|
||||
with probability determined by the input statistics ("a"),
|
||||
and then create a new prefix by removing the first word from the prefix
|
||||
and appending the suffix (making the new prefix is "am a"). Repeat this process
|
||||
until we can't find any suffixes for the current prefix or we exceed the word
|
||||
limit. (The word limit is necessary as the chain table may contain cycles.)
|
||||
|
||||
Our version of this program reads text from standard input, parsing it into a
|
||||
Markov chain, and writes generated text to standard output.
|
||||
The prefix and output lengths can be specified using the -prefix and -words
|
||||
flags on the command-line.
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Prefix is a Markov chain prefix of one or more words.
|
||||
type Prefix []string
|
||||
|
||||
// String returns the Prefix as a string (for use as a map key).
|
||||
func (p Prefix) String() string {
|
||||
return strings.Join(p, " ")
|
||||
}
|
||||
|
||||
// Shift removes the first word from the Prefix and appends the given word.
|
||||
func (p Prefix) Shift(word string) {
|
||||
copy(p, p[1:])
|
||||
p[len(p)-1] = word
|
||||
}
|
||||
|
||||
// Chain contains a map ("chain") of prefixes to a list of suffixes.
|
||||
// A prefix is a string of prefixLen words joined with spaces.
|
||||
// A suffix is a single word. A prefix can have multiple suffixes.
|
||||
type Chain struct {
|
||||
chain map[string][]string
|
||||
prefixLen int
|
||||
}
|
||||
|
||||
// NewChain returns a new Chain with prefixes of prefixLen words.
|
||||
func NewChain(prefixLen int) *Chain {
|
||||
return &Chain{make(map[string][]string), prefixLen}
|
||||
}
|
||||
|
||||
// Build reads text from the provided Reader and
|
||||
// parses it into prefixes and suffixes that are stored in Chain.
|
||||
func (c *Chain) Build(r io.Reader) {
|
||||
br := bufio.NewReader(r)
|
||||
p := make(Prefix, c.prefixLen)
|
||||
for {
|
||||
var s string
|
||||
if _, err := fmt.Fscan(br, &s); err != nil {
|
||||
break
|
||||
}
|
||||
key := p.String()
|
||||
c.chain[key] = append(c.chain[key], s)
|
||||
p.Shift(s)
|
||||
}
|
||||
}
|
||||
|
||||
// Generate returns a string of at most n words generated from Chain.
|
||||
func (c *Chain) Generate(n int) string {
|
||||
p := make(Prefix, c.prefixLen)
|
||||
var words []string
|
||||
for i := 0; i < n; i++ {
|
||||
choices := c.chain[p.String()]
|
||||
if len(choices) == 0 {
|
||||
break
|
||||
}
|
||||
next := choices[rand.Intn(len(choices))]
|
||||
words = append(words, next)
|
||||
p.Shift(next)
|
||||
}
|
||||
return strings.Join(words, " ")
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Register command-line flags.
|
||||
numWords := flag.Int("words", 100, "maximum number of words to print")
|
||||
prefixLen := flag.Int("prefix", 2, "prefix length in words")
|
||||
|
||||
flag.Parse() // Parse command-line flags.
|
||||
rand.Seed(time.Now().UnixNano()) // Seed the random number generator.
|
||||
|
||||
c := NewChain(*prefixLen) // Initialize a new Chain.
|
||||
c.Build(os.Stdin) // Build chains from standard input.
|
||||
text := c.Generate(*numWords) // Generate text.
|
||||
fmt.Println(text) // Write text to standard output.
|
||||
}
|
||||
@@ -1,307 +0,0 @@
|
||||
<!--
|
||||
Copyright 2011 The Go Authors. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style
|
||||
license that can be found in the LICENSE file.
|
||||
-->
|
||||
|
||||
<codewalk title="Generating arbitrary text: a Markov chain algorithm">
|
||||
|
||||
<step title="Introduction" src="doc/codewalk/markov.go:/Generating/,/line\./">
|
||||
This codewalk describes a program that generates random text using
|
||||
a Markov chain algorithm. The package comment describes the algorithm
|
||||
and the operation of the program. Please read it before continuing.
|
||||
</step>
|
||||
|
||||
<step title="Modeling Markov chains" src="doc/codewalk/markov.go:/ chain/">
|
||||
A chain consists of a prefix and a suffix. Each prefix is a set
|
||||
number of words, while a suffix is a single word.
|
||||
A prefix can have an arbitrary number of suffixes.
|
||||
To model this data, we use a <code>map[string][]string</code>.
|
||||
Each map key is a prefix (a <code>string</code>) and its values are
|
||||
lists of suffixes (a slice of strings, <code>[]string</code>).
|
||||
<br/><br/>
|
||||
Here is the example table from the package comment
|
||||
as modeled by this data structure:
|
||||
<pre>
|
||||
map[string][]string{
|
||||
" ": {"I"},
|
||||
" I": {"am"},
|
||||
"I am": {"a", "not"},
|
||||
"a free": {"man!"},
|
||||
"am a": {"free"},
|
||||
"am not": {"a"},
|
||||
"a number!": {"I"},
|
||||
"number! I": {"am"},
|
||||
"not a": {"number!"},
|
||||
}</pre>
|
||||
While each prefix consists of multiple words, we
|
||||
store prefixes in the map as a single <code>string</code>.
|
||||
It would seem more natural to store the prefix as a
|
||||
<code>[]string</code>, but we can't do this with a map because the
|
||||
key type of a map must implement equality (and slices do not).
|
||||
<br/><br/>
|
||||
Therefore, in most of our code we will model prefixes as a
|
||||
<code>[]string</code> and join the strings together with a space
|
||||
to generate the map key:
|
||||
<pre>
|
||||
Prefix Map key
|
||||
|
||||
[]string{"", ""} " "
|
||||
[]string{"", "I"} " I"
|
||||
[]string{"I", "am"} "I am"
|
||||
</pre>
|
||||
</step>
|
||||
|
||||
<step title="The Chain struct" src="doc/codewalk/markov.go:/type Chain/,/}/">
|
||||
The complete state of the chain table consists of the table itself and
|
||||
the word length of the prefixes. The <code>Chain</code> struct stores
|
||||
this data.
|
||||
</step>
|
||||
|
||||
<step title="The NewChain constructor function" src="doc/codewalk/markov.go:/func New/,/\n}/">
|
||||
The <code>Chain</code> struct has two unexported fields (those that
|
||||
do not begin with an upper case character), and so we write a
|
||||
<code>NewChain</code> constructor function that initializes the
|
||||
<code>chain</code> map with <code>make</code> and sets the
|
||||
<code>prefixLen</code> field.
|
||||
<br/><br/>
|
||||
This is constructor function is not strictly necessary as this entire
|
||||
program is within a single package (<code>main</code>) and therefore
|
||||
there is little practical difference between exported and unexported
|
||||
fields. We could just as easily write out the contents of this function
|
||||
when we want to construct a new Chain.
|
||||
But using these unexported fields is good practice; it clearly denotes
|
||||
that only methods of Chain and its constructor function should access
|
||||
those fields. Also, structuring <code>Chain</code> like this means we
|
||||
could easily move it into its own package at some later date.
|
||||
</step>
|
||||
|
||||
<step title="The Prefix type" src="doc/codewalk/markov.go:/type Prefix/">
|
||||
Since we'll be working with prefixes often, we define a
|
||||
<code>Prefix</code> type with the concrete type <code>[]string</code>.
|
||||
Defining a named type clearly allows us to be explicit when we are
|
||||
working with a prefix instead of just a <code>[]string</code>.
|
||||
Also, in Go we can define methods on any named type (not just structs),
|
||||
so we can add methods that operate on <code>Prefix</code> if we need to.
|
||||
</step>
|
||||
|
||||
<step title="The String method" src="doc/codewalk/markov.go:/func[^\n]+String/,/}/">
|
||||
The first method we define on <code>Prefix</code> is
|
||||
<code>String</code>. It returns a <code>string</code> representation
|
||||
of a <code>Prefix</code> by joining the slice elements together with
|
||||
spaces. We will use this method to generate keys when working with
|
||||
the chain map.
|
||||
</step>
|
||||
|
||||
<step title="Building the chain" src="doc/codewalk/markov.go:/func[^\n]+Build/,/\n}/">
|
||||
The <code>Build</code> method reads text from an <code>io.Reader</code>
|
||||
and parses it into prefixes and suffixes that are stored in the
|
||||
<code>Chain</code>.
|
||||
<br/><br/>
|
||||
The <code><a href="/pkg/io/#Reader">io.Reader</a></code> is an
|
||||
interface type that is widely used by the standard library and
|
||||
other Go code. Our code uses the
|
||||
<code><a href="/pkg/fmt/#Fscan">fmt.Fscan</a></code> function, which
|
||||
reads space-separated values from an <code>io.Reader</code>.
|
||||
<br/><br/>
|
||||
The <code>Build</code> method returns once the <code>Reader</code>'s
|
||||
<code>Read</code> method returns <code>io.EOF</code> (end of file)
|
||||
or some other read error occurs.
|
||||
</step>
|
||||
|
||||
<step title="Buffering the input" src="doc/codewalk/markov.go:/bufio\.NewReader/">
|
||||
This function does many small reads, which can be inefficient for some
|
||||
<code>Readers</code>. For efficiency we wrap the provided
|
||||
<code>io.Reader</code> with
|
||||
<code><a href="/pkg/bufio/">bufio.NewReader</a></code> to create a
|
||||
new <code>io.Reader</code> that provides buffering.
|
||||
</step>
|
||||
|
||||
<step title="The Prefix variable" src="doc/codewalk/markov.go:/make\(Prefix/">
|
||||
At the top of the function we make a <code>Prefix</code> slice
|
||||
<code>p</code> using the <code>Chain</code>'s <code>prefixLen</code>
|
||||
field as its length.
|
||||
We'll use this variable to hold the current prefix and mutate it with
|
||||
each new word we encounter.
|
||||
</step>
|
||||
|
||||
<step title="Scanning words" src="doc/codewalk/markov.go:/var s string/,/\n }/">
|
||||
In our loop we read words from the <code>Reader</code> into a
|
||||
<code>string</code> variable <code>s</code> using
|
||||
<code>fmt.Fscan</code>. Since <code>Fscan</code> uses space to
|
||||
separate each input value, each call will yield just one word
|
||||
(including punctuation), which is exactly what we need.
|
||||
<br/><br/>
|
||||
<code>Fscan</code> returns an error if it encounters a read error
|
||||
(<code>io.EOF</code>, for example) or if it can't scan the requested
|
||||
value (in our case, a single string). In either case we just want to
|
||||
stop scanning, so we <code>break</code> out of the loop.
|
||||
</step>
|
||||
|
||||
<step title="Adding a prefix and suffix to the chain" src="doc/codewalk/markov.go:/ key/,/key\], s\)">
|
||||
The word stored in <code>s</code> is a new suffix. We add the new
|
||||
prefix/suffix combination to the <code>chain</code> map by computing
|
||||
the map key with <code>p.String</code> and appending the suffix
|
||||
to the slice stored under that key.
|
||||
<br/><br/>
|
||||
The built-in <code>append</code> function appends elements to a slice
|
||||
and allocates new storage when necessary. When the provided slice is
|
||||
<code>nil</code>, <code>append</code> allocates a new slice.
|
||||
This behavior conveniently ties in with the semantics of our map:
|
||||
retrieving an unset key returns the zero value of the value type and
|
||||
the zero value of <code>[]string</code> is <code>nil</code>.
|
||||
When our program encounters a new prefix (yielding a <code>nil</code>
|
||||
value in the map) <code>append</code> will allocate a new slice.
|
||||
<br/><br/>
|
||||
For more information about the <code>append</code> function and slices
|
||||
in general see the
|
||||
<a href="/doc/articles/slices_usage_and_internals.html">Slices: usage and internals</a> article.
|
||||
</step>
|
||||
|
||||
<step title="Pushing the suffix onto the prefix" src="doc/codewalk/markov.go:/p\.Shift/">
|
||||
Before reading the next word our algorithm requires us to drop the
|
||||
first word from the prefix and push the current suffix onto the prefix.
|
||||
<br/><br/>
|
||||
When in this state
|
||||
<pre>
|
||||
p == Prefix{"I", "am"}
|
||||
s == "not" </pre>
|
||||
the new value for <code>p</code> would be
|
||||
<pre>
|
||||
p == Prefix{"am", "not"}</pre>
|
||||
This operation is also required during text generation so we put
|
||||
the code to perform this mutation of the slice inside a method on
|
||||
<code>Prefix</code> named <code>Shift</code>.
|
||||
</step>
|
||||
|
||||
<step title="The Shift method" src="doc/codewalk/markov.go:/func[^\n]+Shift/,/\n}/">
|
||||
The <code>Shift</code> method uses the built-in <code>copy</code>
|
||||
function to copy the last len(p)-1 elements of <code>p</code> to
|
||||
the start of the slice, effectively moving the elements
|
||||
one index to the left (if you consider zero as the leftmost index).
|
||||
<pre>
|
||||
p := Prefix{"I", "am"}
|
||||
copy(p, p[1:])
|
||||
// p == Prefix{"am", "am"}</pre>
|
||||
We then assign the provided <code>word</code> to the last index
|
||||
of the slice:
|
||||
<pre>
|
||||
// suffix == "not"
|
||||
p[len(p)-1] = suffix
|
||||
// p == Prefix{"am", "not"}</pre>
|
||||
</step>
|
||||
|
||||
<step title="Generating text" src="doc/codewalk/markov.go:/func[^\n]+Generate/,/\n}/">
|
||||
The <code>Generate</code> method is similar to <code>Build</code>
|
||||
except that instead of reading words from a <code>Reader</code>
|
||||
and storing them in a map, it reads words from the map and
|
||||
appends them to a slice (<code>words</code>).
|
||||
<br/><br/>
|
||||
<code>Generate</code> uses a conditional for loop to generate
|
||||
up to <code>n</code> words.
|
||||
</step>
|
||||
|
||||
<step title="Getting potential suffixes" src="doc/codewalk/markov.go:/choices/,/}\n/">
|
||||
At each iteration of the loop we retrieve a list of potential suffixes
|
||||
for the current prefix. We access the <code>chain</code> map at key
|
||||
<code>p.String()</code> and assign its contents to <code>choices</code>.
|
||||
<br/><br/>
|
||||
If <code>len(choices)</code> is zero we break out of the loop as there
|
||||
are no potential suffixes for that prefix.
|
||||
This test also works if the key isn't present in the map at all:
|
||||
in that case, <code>choices</code> will be <code>nil</code> and the
|
||||
length of a <code>nil</code> slice is zero.
|
||||
</step>
|
||||
|
||||
<step title="Choosing a suffix at random" src="doc/codewalk/markov.go:/next := choices/,/Shift/">
|
||||
To choose a suffix we use the
|
||||
<code><a href="/pkg/math/rand/#Intn">rand.Intn</a></code> function.
|
||||
It returns a random integer up to (but not including) the provided
|
||||
value. Passing in <code>len(choices)</code> gives us a random index
|
||||
into the full length of the list.
|
||||
<br/><br/>
|
||||
We use that index to pick our new suffix, assign it to
|
||||
<code>next</code> and append it to the <code>words</code> slice.
|
||||
<br/><br/>
|
||||
Next, we <code>Shift</code> the new suffix onto the prefix just as
|
||||
we did in the <code>Build</code> method.
|
||||
</step>
|
||||
|
||||
<step title="Returning the generated text" src="doc/codewalk/markov.go:/Join\(words/">
|
||||
Before returning the generated text as a string, we use the
|
||||
<code>strings.Join</code> function to join the elements of
|
||||
the <code>words</code> slice together, separated by spaces.
|
||||
</step>
|
||||
|
||||
<step title="Command-line flags" src="doc/codewalk/markov.go:/Register command-line flags/,/prefixLen/">
|
||||
To make it easy to tweak the prefix and generated text lengths we
|
||||
use the <code><a href="/pkg/flag/">flag</a></code> package to parse
|
||||
command-line flags.
|
||||
<br/><br/>
|
||||
These calls to <code>flag.Int</code> register new flags with the
|
||||
<code>flag</code> package. The arguments to <code>Int</code> are the
|
||||
flag name, its default value, and a description. The <code>Int</code>
|
||||
function returns a pointer to an integer that will contain the
|
||||
user-supplied value (or the default value if the flag was omitted on
|
||||
the command-line).
|
||||
</step>
|
||||
|
||||
<step title="Program set up" src="doc/codewalk/markov.go:/flag.Parse/,/rand.Seed/">
|
||||
The <code>main</code> function begins by parsing the command-line
|
||||
flags with <code>flag.Parse</code> and seeding the <code>rand</code>
|
||||
package's random number generator with the current time.
|
||||
<br/><br/>
|
||||
If the command-line flags provided by the user are invalid the
|
||||
<code>flag.Parse</code> function will print an informative usage
|
||||
message and terminate the program.
|
||||
</step>
|
||||
|
||||
<step title="Creating and building a new Chain" src="doc/codewalk/markov.go:/c := NewChain/,/c\.Build/">
|
||||
To create the new <code>Chain</code> we call <code>NewChain</code>
|
||||
with the value of the <code>prefix</code> flag.
|
||||
<br/><br/>
|
||||
To build the chain we call <code>Build</code> with
|
||||
<code>os.Stdin</code> (which implements <code>io.Reader</code>) so
|
||||
that it will read its input from standard input.
|
||||
</step>
|
||||
|
||||
<step title="Generating and printing text" src="doc/codewalk/markov.go:/c\.Generate/,/fmt.Println/">
|
||||
Finally, to generate text we call <code>Generate</code> with
|
||||
the value of the <code>words</code> flag and assigning the result
|
||||
to the variable <code>text</code>.
|
||||
<br/><br/>
|
||||
Then we call <code>fmt.Println</code> to write the text to standard
|
||||
output, followed by a carriage return.
|
||||
</step>
|
||||
|
||||
<step title="Using this program" src="doc/codewalk/markov.go">
|
||||
To use this program, first build it with the
|
||||
<a href="/cmd/go/">go</a> command:
|
||||
<pre>
|
||||
$ go build markov.go</pre>
|
||||
And then execute it while piping in some input text:
|
||||
<pre>
|
||||
$ echo "a man a plan a canal panama" \
|
||||
| ./markov -prefix=1
|
||||
a plan a man a plan a canal panama</pre>
|
||||
Here's a transcript of generating some text using the Go distribution's
|
||||
README file as source material:
|
||||
<pre>
|
||||
$ ./markov -words=10 < $GOROOT/README
|
||||
This is the source code repository for the Go source
|
||||
$ ./markov -prefix=1 -words=10 < $GOROOT/README
|
||||
This is the go directory (the one containing this README).
|
||||
$ ./markov -prefix=1 -words=10 < $GOROOT/README
|
||||
This is the variable if you have just untarred a</pre>
|
||||
</step>
|
||||
|
||||
<step title="An exercise for the reader" src="doc/codewalk/markov.go">
|
||||
The <code>Generate</code> function does a lot of allocations when it
|
||||
builds the <code>words</code> slice. As an exercise, modify it to
|
||||
take an <code>io.Writer</code> to which it incrementally writes the
|
||||
generated text with <code>Fprint</code>.
|
||||
Aside from being more efficient this makes <code>Generate</code>
|
||||
more symmetrical to <code>Build</code>.
|
||||
</step>
|
||||
|
||||
</codewalk>
|
||||
@@ -6,7 +6,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"rand"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -23,7 +23,7 @@ type score struct {
|
||||
// An action transitions stochastically to a resulting score.
|
||||
type action func(current score) (result score, turnIsOver bool)
|
||||
|
||||
// roll returns the (result, turnIsOver) outcome of simulating a die roll.
|
||||
// roll returns the (result, turnIsOver) outcome of simulating a die roll.
|
||||
// If the roll value is 1, then thisTurn score is abandoned, and the players'
|
||||
// roles swap. Otherwise, the roll value is added to thisTurn.
|
||||
func roll(s score) (score, bool) {
|
||||
@@ -61,6 +61,9 @@ func play(strategy0, strategy1 strategy) int {
|
||||
currentPlayer := rand.Intn(2) // Randomly decide who plays first
|
||||
for s.player+s.thisTurn < win {
|
||||
action := strategies[currentPlayer](s)
|
||||
if action != roll && action != stay {
|
||||
panic(fmt.Sprintf("Player %d is cheating", currentPlayer))
|
||||
}
|
||||
s, turnIsOver = action(s)
|
||||
if turnIsOver {
|
||||
currentPlayer = (currentPlayer + 1) % 2
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2013 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
set -e
|
||||
|
||||
function fail {
|
||||
echo FAIL: doc/codewalk/$1
|
||||
exit 1
|
||||
}
|
||||
|
||||
# markov.xml
|
||||
echo foo | go run markov.go | grep foo > /dev/null || fail markov
|
||||
|
||||
# functions.xml
|
||||
go run pig.go | grep 'Wins, losses staying at k = 100: 210/990 (21.2%), 780/990 (78.8%)' > /dev/null || fail pig
|
||||
|
||||
# sharemem.xml: only build the example, as it uses the network
|
||||
go build urlpoll.go || fail urlpoll
|
||||
rm -f urlpoll
|
||||
@@ -65,7 +65,7 @@ and then loops passing completed Resources back to the pending
|
||||
channel after appropriate delays.
|
||||
</step>
|
||||
|
||||
<step title="Creating channels" src="doc/codewalk/urlpoll.go:/Create our/,/complete/">
|
||||
<step title="Creating channels" src="doc/codewalk/urlpoll.go:/create our/,/complete/">
|
||||
First, main makes two channels of *Resource, pending and complete.
|
||||
<br/><br/>
|
||||
Inside main, a new goroutine sends one Resource per URL to pending
|
||||
@@ -75,7 +75,7 @@ The pending and complete channels are passed to each of the Poller
|
||||
goroutines, within which they are known as in and out.
|
||||
</step>
|
||||
|
||||
<step title="Initializing StateMonitor" src="doc/codewalk/urlpoll.go:/Launch the StateMonitor/,/statusInterval/">
|
||||
<step title="Initializing StateMonitor" src="doc/codewalk/urlpoll.go:/launch the StateMonitor/,/statusInterval/">
|
||||
StateMonitor will initialize and launch a goroutine that stores the state
|
||||
of each Resource. We will look at this function in detail later.
|
||||
<br/><br/>
|
||||
@@ -83,14 +83,14 @@ For now, the important thing to note is that it returns a channel of State,
|
||||
which is saved as status and passed to the Poller goroutines.
|
||||
</step>
|
||||
|
||||
<step title="Launching Poller goroutines" src="doc/codewalk/urlpoll.go:/Launch some Poller/,/}/">
|
||||
<step title="Launching Poller goroutines" src="doc/codewalk/urlpoll.go:/launch some Poller/,/}/">
|
||||
Now that it has the necessary channels, main launches a number of
|
||||
Poller goroutines, passing the channels as arguments.
|
||||
The channels provide the means of communication between the main, Poller, and
|
||||
StateMonitor goroutines.
|
||||
</step>
|
||||
|
||||
<step title="Send Resources to pending" src="doc/codewalk/urlpoll.go:/Send some Resources/,/}\(\)/">
|
||||
<step title="Send Resources to pending" src="doc/codewalk/urlpoll.go:/send some Resources/,/}\(\)/">
|
||||
To add the initial work to the system, main starts a new goroutine
|
||||
that allocates and sends one Resource per URL to pending.
|
||||
<br/><br/>
|
||||
@@ -171,7 +171,7 @@ and/or writes to a shared map.
|
||||
|
||||
<step title="Conclusion" src="doc/codewalk/urlpoll.go">
|
||||
In this codewalk we have explored a simple example of using Go's concurrency
|
||||
primitives to share memory through communication.
|
||||
primitives to share memory through commmunication.
|
||||
<br/><br/>
|
||||
This should provide a starting point from which to explore the ways in which
|
||||
goroutines and channels can be used to write expressive and concise concurrent
|
||||
|
||||
@@ -5,16 +5,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"http"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
numPollers = 2 // number of Poller goroutines to launch
|
||||
pollInterval = 60 * time.Second // how often to poll each URL
|
||||
statusInterval = 10 * time.Second // how often to log status to stdout
|
||||
errTimeout = 10 * time.Second // back-off timeout on error
|
||||
numPollers = 2 // number of Poller goroutines to launch
|
||||
second = 1e9 // one second is 1e9 nanoseconds
|
||||
pollInterval = 60 * second // how often to poll each URL
|
||||
statusInterval = 10 * second // how often to log status to stdout
|
||||
errTimeout = 10 * second // back-off timeout on error
|
||||
)
|
||||
|
||||
var urls = []string{
|
||||
@@ -32,7 +33,7 @@ type State struct {
|
||||
// StateMonitor maintains a map that stores the state of the URLs being
|
||||
// polled, and prints the current state every updateInterval nanoseconds.
|
||||
// It returns a chan State to which resource state should be sent.
|
||||
func StateMonitor(updateInterval time.Duration) chan<- State {
|
||||
func StateMonitor(updateInterval int64) chan<- State {
|
||||
updates := make(chan State)
|
||||
urlStatus := make(map[string]string)
|
||||
ticker := time.NewTicker(updateInterval)
|
||||
@@ -60,7 +61,7 @@ func logState(s map[string]string) {
|
||||
// Resource represents an HTTP URL to be polled by this program.
|
||||
type Resource struct {
|
||||
url string
|
||||
errCount int
|
||||
errCount int64
|
||||
}
|
||||
|
||||
// Poll executes an HTTP HEAD request for url
|
||||
@@ -70,16 +71,16 @@ func (r *Resource) Poll() string {
|
||||
if err != nil {
|
||||
log.Println("Error", r.url, err)
|
||||
r.errCount++
|
||||
return err.Error()
|
||||
return err.String()
|
||||
}
|
||||
r.errCount = 0
|
||||
return resp.Status
|
||||
}
|
||||
|
||||
// Sleep sleeps for an appropriate interval (dependent on error state)
|
||||
// Sleep sleeps for an appropriate interval (dependant on error state)
|
||||
// before sending the Resource to done.
|
||||
func (r *Resource) Sleep(done chan<- *Resource) {
|
||||
time.Sleep(pollInterval + errTimeout*time.Duration(r.errCount))
|
||||
func (r *Resource) Sleep(done chan *Resource) {
|
||||
time.Sleep(pollInterval + errTimeout*r.errCount)
|
||||
done <- r
|
||||
}
|
||||
|
||||
@@ -92,18 +93,18 @@ func Poller(in <-chan *Resource, out chan<- *Resource, status chan<- State) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Create our input and output channels.
|
||||
// create our input and output channels
|
||||
pending, complete := make(chan *Resource), make(chan *Resource)
|
||||
|
||||
// Launch the StateMonitor.
|
||||
// launch the StateMonitor
|
||||
status := StateMonitor(statusInterval)
|
||||
|
||||
// Launch some Poller goroutines.
|
||||
// launch some Poller goroutines
|
||||
for i := 0; i < numPollers; i++ {
|
||||
go Poller(pending, complete, status)
|
||||
}
|
||||
|
||||
// Send some Resources to the pending queue.
|
||||
// send some Resources to the pending queue
|
||||
go func() {
|
||||
for _, url := range urls {
|
||||
pending <- &Resource{url: url}
|
||||
|
||||
53
doc/community.html
Normal file
53
doc/community.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!-- title Community -->
|
||||
|
||||
<div class="left-column">
|
||||
|
||||
<h2 id="developer_info">The Go Community</h2>
|
||||
|
||||
<h3 id="mailinglist"><a href="http://groups.google.com/group/golang-nuts">Go Nuts Mailing List</a></h3>
|
||||
<p>The <a href="http://groups.google.com/group/golang-nuts">golang-nuts</a>
|
||||
mailing list is for general Go discussion.</p>
|
||||
|
||||
<h3 id=""><a href="http://godashboard.appspot.com/package">Go Packages Dashboard</a></h3>
|
||||
<p>A list of the most popular <a href="/cmd/goinstall/">goinstall</a>'d
|
||||
Go libraries.</p>
|
||||
|
||||
<h3 id=""><a href="http://godashboard.appspot.com/project">Go Project Dashboard</a></h3>
|
||||
<p>A list of external Go projects including programs and libraries.</p>
|
||||
|
||||
<h3 id="irc"><a href="irc:irc.freenode.net/go-nuts">Go IRC Channel</a></h3>
|
||||
<p><b>#go-nuts</b> on <b>irc.freenode.net</b> is the official Go IRC channel.</p>
|
||||
|
||||
<h3 id="twitter"><a href="http://twitter.com/go_nuts">@go_nuts at Twitter</a></h3>
|
||||
<p>The Go project's official Twitter account.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="right-column">
|
||||
|
||||
<h2 id="blogs">Blogs</h2>
|
||||
|
||||
<h3 id="blog_go"><a href="http://blog.golang.org/">The Go Blog</a></h3>
|
||||
<p>
|
||||
The Go project's official blog, maintained by the core Go developers.
|
||||
</p>
|
||||
|
||||
<h3 id="blog_rsc"><a href="http://research.swtch.com/search/label/Go">research!rsc</a></h3>
|
||||
<p>
|
||||
Posts labelled 'Go' by Russ Cox, one of the core Go developers.
|
||||
</p>
|
||||
|
||||
<h3 id="blog_iant"><a href="http://www.airs.com/blog/archives/category/programming">Airs</a></h3>
|
||||
<p>
|
||||
Posts labelled 'Programming' by Ian Lance Taylor, one of the core Go developers.
|
||||
</p>
|
||||
|
||||
<h3 id="blog_adg"><a href="http://nf.id.au/tag/go">nf.id.au</a></h3>
|
||||
<p>
|
||||
Posts labelled 'Go' by Andrew Gerrand, one of the core Go developers.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="end-columns"></div>
|
||||
|
||||
260
doc/conduct.html
260
doc/conduct.html
@@ -1,260 +0,0 @@
|
||||
<!--{
|
||||
"Title": "Go Community Code of Conduct",
|
||||
"Path": "/conduct",
|
||||
"Template": true
|
||||
}-->
|
||||
|
||||
<style>
|
||||
ul {
|
||||
max-width: 800px;
|
||||
}
|
||||
ul ul {
|
||||
margin: 0 0 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2 id="about">About the Code of Conduct</h2>
|
||||
|
||||
<h3 id="why">Why have a Code of Conduct?</h3>
|
||||
|
||||
<p>
|
||||
Online communities include people from many different backgrounds.
|
||||
The Go contributors are committed to providing a friendly, safe and welcoming
|
||||
environment for all, regardless of age, disability, gender, nationality,
|
||||
ethnicity, religion, sexuality, or similar personal characteristic.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The first goal of the Code of Conduct is to specify a baseline standard
|
||||
of behavior so that people with different social values and communication
|
||||
styles can talk about Go effectively, productively, and respectfully.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The second goal is to provide a mechanism for resolving conflicts in the
|
||||
community when they arise.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The third goal of the Code of Conduct is to make our community welcoming to
|
||||
people from different backgrounds.
|
||||
Diversity is critical to the project; for Go to be successful, it needs
|
||||
contributors and users from all backgrounds.
|
||||
(See <a href="https://blog.golang.org/open-source">Go, Open Source, Community</a>.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
With that said, a healthy community must allow for disagreement and debate.
|
||||
The Code of Conduct is not a mechanism for people to silence others with whom
|
||||
they disagree.
|
||||
</p>
|
||||
|
||||
<h3 id="spaces">Where does the Code of Conduct apply?</h3>
|
||||
|
||||
<p>
|
||||
If you participate in or contribute to the Go ecosystem in any way,
|
||||
you are encouraged to follow the Code of Conduct while doing so.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Explicit enforcement of the Code of Conduct applies to the
|
||||
official forums operated by the Go project (“Go spaces”):
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>The official <a href="https://github.com/golang/">GitHub projects</a>
|
||||
and <a href="https://go-review.googlesource.com/">code reviews</a>.
|
||||
<li>The <a href="https://groups.google.com/group/golang-nuts">golang-nuts</a> and
|
||||
<a href="https://groups.google.com/group/golang-dev">golang-dev</a> mailing lists.
|
||||
<li>The #go-nuts IRC channel on Freenode.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Other Go groups (such as conferences, meetups, and other unofficial forums) are
|
||||
encouraged to adopt this Code of Conduct. Those groups must provide their own
|
||||
moderators and/or working group (see below).
|
||||
</p>
|
||||
|
||||
<h2 id="values">Gopher values</h2>
|
||||
|
||||
<p>
|
||||
These are the values to which people in the Go community (“Gophers”) should aspire.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Be friendly and welcoming
|
||||
<li>Be patient
|
||||
<ul>
|
||||
<li>Remember that people have varying communication styles and that not
|
||||
everyone is using their native language.
|
||||
(Meaning and tone can be lost in translation.)
|
||||
</ul>
|
||||
<li>Be thoughtful
|
||||
<ul>
|
||||
<li>Productive communication requires effort.
|
||||
Think about how your words will be interpreted.
|
||||
<li>Remember that sometimes it is best to refrain entirely from commenting.
|
||||
</ul>
|
||||
<li>Be respectful
|
||||
<ul>
|
||||
<li>In particular, respect differences of opinion.
|
||||
</ul>
|
||||
<li>Be charitable
|
||||
<ul>
|
||||
<li>Interpret the arguments of others in good faith, do not seek to disagree.
|
||||
<li>When we do disagree, try to understand why.
|
||||
</ul>
|
||||
<li>Avoid destructive behavior:
|
||||
<ul>
|
||||
<li>Derailing: stay on topic; if you want to talk about something else,
|
||||
start a new conversation.
|
||||
<li>Unconstructive criticism: don't merely decry the current state of affairs;
|
||||
offer—or at least solicit—suggestions as to how things may be improved.
|
||||
<li>Snarking (pithy, unproductive, sniping comments)
|
||||
<li>Discussing potentially offensive or sensitive issues;
|
||||
this all too often leads to unnecessary conflict.
|
||||
<li>Microaggressions: brief and commonplace verbal, behavioral and
|
||||
environmental indignities that communicate hostile, derogatory or negative
|
||||
slights and insults to a person or group.
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
People are complicated.
|
||||
You should expect to be misunderstood and to misunderstand others;
|
||||
when this inevitably occurs, resist the urge to be defensive or assign blame.
|
||||
Try not to take offense where no offense was intended.
|
||||
Give people the benefit of the doubt.
|
||||
Even if the intent was to provoke, do not rise to it.
|
||||
It is the responsibility of <i>all parties</i> to de-escalate conflict when it arises.
|
||||
</p>
|
||||
|
||||
<h2 id="unwelcome_behavior">Unwelcome behavior</h2>
|
||||
|
||||
<p>
|
||||
These actions are explicitly forbidden in Go spaces:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Insulting, demeaning, hateful, or threatening remarks.
|
||||
<li>Discrimination based on age, disability, gender, nationality, race,
|
||||
religion, sexuality, or similar personal characteristic.
|
||||
<li>Bullying or systematic harassment.
|
||||
<li>Unwelcome sexual advances.
|
||||
<li>Incitement to any of these.
|
||||
</ul>
|
||||
|
||||
<h2 id="moderation">Moderation</h2>
|
||||
|
||||
<p>
|
||||
The Go spaces are not free speech venues; they are for discussion about Go.
|
||||
Each of these spaces have their own moderators.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When using the official Go spaces you should act in the spirit of the “Gopher
|
||||
values”.
|
||||
If a reported conflict cannot be resolved amicably, the CoC Working Group
|
||||
may make a recommendation to the relevant forum moderators.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
CoC Working Group members and forum moderators are held to a higher standard than other community members.
|
||||
If a working group member or moderator creates an inappropriate situation, they
|
||||
should expect less leeway than others, and should expect to be removed from
|
||||
their position if they cannot adhere to the CoC.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Complaints about working group member or moderator actions must be handled
|
||||
using the reporting process below.
|
||||
</p>
|
||||
|
||||
<h2 id="reporting">Reporting issues</h2>
|
||||
|
||||
<p>
|
||||
The Code of Conduct Working Group is a group of people that represent the Go
|
||||
community. They are responsible for handling conduct-related issues.
|
||||
Their purpose is to de-escalate conflicts and try to resolve issues to the
|
||||
satisfaction of all parties. They are:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Aditya Mukerjee <dev@chimeracoder.net>
|
||||
<li>Andrew Gerrand <adg@golang.org>
|
||||
<li>Peggy Li <peggyli.224@gmail.com>
|
||||
<li>Sarah Adams <sadams.codes@gmail.com>
|
||||
<li>Steve Francia <steve.francia@gmail.com>
|
||||
<li>Verónica López <gveronicalg@gmail.com>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
If you encounter a conduct-related issue, you should report it to the
|
||||
Working Group using the process described below.
|
||||
<b>Do not</b> post about the issue publicly or try to rally sentiment against a
|
||||
particular individual or group.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Mail <a href="mailto:conduct@golang.org">conduct@golang.org</a>.
|
||||
<ul>
|
||||
<li>Your message will reach the Working Group.
|
||||
<li>Reports are confidential within the Working Group.
|
||||
<li>You may contact a member of the group directly if you do not feel
|
||||
comfortable contacting the group as a whole. That member will then raise
|
||||
the issue with the Working Group as a whole, preserving the privacy of the
|
||||
reporter (if desired).
|
||||
<li>If your report concerns a member of the Working Group they will be recused
|
||||
from Working Group discussions of the report.
|
||||
<li>The Working Group will strive to handle reports with discretion and
|
||||
sensitivity, to protect the privacy of the involved parties,
|
||||
and to avoid conflicts of interest.
|
||||
</ul>
|
||||
<li>You should receive a response within 48 hours (likely sooner).
|
||||
(Should you choose to contact a single Working Group member,
|
||||
it may take longer to receive a response.)
|
||||
<li>The Working Group will meet to review the incident and determine what happened.
|
||||
<ul>
|
||||
<li>With the permission of person reporting the incident, the Working Group
|
||||
may reach out to other community members for more context.
|
||||
</ul>
|
||||
<li>The Working Group will reach a decision as to how to act. These may include:
|
||||
<ul>
|
||||
<li>Nothing.
|
||||
<li>Passing the report along to the offender.
|
||||
<li>A recommendation of action to the relevant forum moderators.
|
||||
</ul>
|
||||
<li>The Working Group will reach out to the original reporter to let them know
|
||||
the decision.
|
||||
<li>Appeals to the decision may be made to the Working Group,
|
||||
or to any of its members directly.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<b>Note that the goal of the Code of Conduct and the Working Group is to resolve
|
||||
conflicts in the most harmonious way possible.</b>
|
||||
We hope that in most cases issues may be resolved through polite discussion and
|
||||
mutual agreement.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Changes to the Code of Conduct (including to the members of the Working Group)
|
||||
should be proposed using the
|
||||
<a href="https://golang.org/s/proposal-process">change proposal process</a>.
|
||||
</p>
|
||||
|
||||
<h2 id="summary">Summary</h2>
|
||||
|
||||
<ul>
|
||||
<li>Treat everyone with respect and kindness.
|
||||
<li>Be thoughtful in how you communicate.
|
||||
<li>Don’t be destructive or inflammatory.
|
||||
<li>If you encounter an issue, please mail <a href="mailto:conduct@golang.org">conduct@golang.org</a>.
|
||||
</ul>
|
||||
|
||||
<h3 id="acknowledgements">Acknowledgements</h3>
|
||||
|
||||
<p>
|
||||
Parts of this document were derived from the Code of Conduct documents of the
|
||||
Django, FreeBSD, and Rust projects.
|
||||
</p>
|
||||
133
doc/contrib.html
133
doc/contrib.html
@@ -1,89 +1,16 @@
|
||||
<!--{
|
||||
"Title": "The Go Project",
|
||||
"Path": "/project/"
|
||||
}-->
|
||||
|
||||
<img class="gopher" src="/doc/gopher/project.png" />
|
||||
|
||||
<div id="manual-nav"></div>
|
||||
|
||||
<p>
|
||||
Go is an open source project developed by a team at
|
||||
<a href="//google.com/">Google</a> and many
|
||||
<a href="/CONTRIBUTORS">contributors</a> from the open source community.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Go is distributed under a <a href="/LICENSE">BSD-style license</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="announce"><a href="//groups.google.com/group/golang-announce">Announcements Mailing List</a></h3>
|
||||
<p>
|
||||
A low traffic mailing list for important announcements, such as new releases.
|
||||
</p>
|
||||
<p>
|
||||
We encourage all Go users to subscribe to
|
||||
<a href="//groups.google.com/group/golang-announce">golang-announce</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="go1">Version history</h2>
|
||||
|
||||
<h3 id="release"><a href="/doc/devel/release.html">Release History</a></h3>
|
||||
|
||||
<p>A <a href="/doc/devel/release.html">summary</a> of the changes between Go releases. Notes for the major releases:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="/doc/go1.8">Go 1.8</a> <small>(February 2017)</small></li>
|
||||
<li><a href="/doc/go1.7">Go 1.7</a> <small>(August 2016)</small></li>
|
||||
<li><a href="/doc/go1.6">Go 1.6</a> <small>(February 2016)</small></li>
|
||||
<li><a href="/doc/go1.5">Go 1.5</a> <small>(August 2015)</small></li>
|
||||
<li><a href="/doc/go1.4">Go 1.4</a> <small>(December 2014)</small></li>
|
||||
<li><a href="/doc/go1.3">Go 1.3</a> <small>(June 2014)</small></li>
|
||||
<li><a href="/doc/go1.2">Go 1.2</a> <small>(December 2013)</small></li>
|
||||
<li><a href="/doc/go1.1">Go 1.1</a> <small>(May 2013)</small></li>
|
||||
<li><a href="/doc/go1">Go 1</a> <small>(March 2012)</small></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="go1compat"><a href="/doc/go1compat">Go 1 and the Future of Go Programs</a></h3>
|
||||
<p>
|
||||
What Go 1 defines and the backwards-compatibility guarantees one can expect as
|
||||
Go 1 matures.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="resources">Developer Resources</h2>
|
||||
|
||||
<h3 id="source"><a href="https://golang.org/change">Source Code</a></h3>
|
||||
<p>Check out the Go source code.</p>
|
||||
|
||||
<h3 id="golang-dev"><a href="https://groups.google.com/group/golang-dev">Developer</a> and
|
||||
<a href="https://groups.google.com/group/golang-codereviews">Code Review Mailing List</a></h3>
|
||||
<p>The <a href="https://groups.google.com/group/golang-dev">golang-dev</a>
|
||||
mailing list is for discussing code changes to the Go project.
|
||||
The <a href="https://groups.google.com/group/golang-codereviews">golang-codereviews</a>
|
||||
mailing list is for actual reviewing of the code changes (CLs).</p>
|
||||
|
||||
<p>For general discussion of Go programming, see <a
|
||||
href="https://groups.google.com/group/golang-nuts">golang-nuts</a>.</p>
|
||||
|
||||
<h3 id="golang-checkins"><a href="https://groups.google.com/group/golang-checkins">Checkins Mailing List</a></h3>
|
||||
<p>A mailing list that receives a message summarizing each checkin to the Go repository.</p>
|
||||
|
||||
<h3 id="build_status"><a href="//build.golang.org/">Build Status</a></h3>
|
||||
<p>View the status of Go builds across the supported operating
|
||||
systems and architectures.</p>
|
||||
<!-- title Contributing -->
|
||||
|
||||
<div class="left-column">
|
||||
|
||||
<h2 id="howto">How you can help</h2>
|
||||
|
||||
<h3><a href="//golang.org/issue">Reporting issues</a></h3>
|
||||
<h3>Reporting issues</h3>
|
||||
|
||||
<p>
|
||||
If you spot bugs, mistakes, or inconsistencies in the Go project's code or
|
||||
documentation, please let us know by
|
||||
<a href="//golang.org/issue/new">filing a ticket</a>
|
||||
on our <a href="//golang.org/issue">issue tracker</a>.
|
||||
<a href="http://code.google.com/p/go/issues/entry">filing a ticket</a>
|
||||
on our <a href="http://code.google.com/p/go/issues">issue tracker</a>.
|
||||
(Of course, you should check it's not an existing issue before creating
|
||||
a new one.)
|
||||
</p>
|
||||
@@ -92,30 +19,48 @@ a new one.)
|
||||
We pride ourselves on being meticulous; no issue is too small.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Security-related issues should be reported to
|
||||
<a href="mailto:security@golang.org">security@golang.org</a>.<br>
|
||||
See the <a href="/security">security policy</a> for more details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Community-related issues should be reported to
|
||||
<a href="mailto:conduct@golang.org">conduct@golang.org</a>.<br>
|
||||
See the <a href="/conduct">Code of Conduct</a> for more details.
|
||||
</p>
|
||||
|
||||
<h3><a href="/doc/contribute.html">Contributing code</a></h3>
|
||||
<h3>Contributing code</h3>
|
||||
|
||||
<p>
|
||||
Go is an open source project and we welcome contributions from the community.
|
||||
</p>
|
||||
<p>
|
||||
To get started, read these <a href="/doc/contribute.html">contribution
|
||||
To get started, read these <a href="contribute.html">contribution
|
||||
guidelines</a> for information on design, testing, and our code review process.
|
||||
</p>
|
||||
<p>
|
||||
Check <a href="//golang.org/issue">the tracker</a> for
|
||||
Check <a href="http://code.google.com/p/go/issues">the tracker</a> for
|
||||
open issues that interest you. Those labeled
|
||||
<a href="https://github.com/golang/go/issues?q=is%3Aopen+is%3Aissue+label%3Ahelpwanted">helpwanted</a>
|
||||
<a href="http://code.google.com/p/go/issues/list?q=status=HelpWanted">HelpWanted</a>
|
||||
are particularly in need of outside help.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="right-column">
|
||||
|
||||
<h2 id="">The Go Project</h2>
|
||||
|
||||
<h3 id="build_status"><a href="http://godashboard.appspot.com/">Build Status</a></h3>
|
||||
<p>View the status of Go builds across the supported operating
|
||||
systems and architectures.</p>
|
||||
|
||||
<h3 id="roadmap"><a href="devel/roadmap.html">Roadmap</a></h3>
|
||||
<p>Features and ideas being developed or discussed by the Go team.</p>
|
||||
|
||||
<h3 id="release"><a href="devel/release.html">Release History</a></h3>
|
||||
<p>A summary of the changes between tagged releases of Go.</p>
|
||||
|
||||
<h3 id="golang-dev"><a href="http://groups.google.com/group/golang-dev">Developer Mailing List</a></h3>
|
||||
<p>The <a href="http://groups.google.com/group/golang-dev">golang-dev</a>
|
||||
mailing list is for discussing and reviewing code for the Go project.</p>
|
||||
<p>For general discussion of Go programming, see <a
|
||||
href="http://groups.google.com/group/golang-nuts">golang-nuts</a>.</p>
|
||||
|
||||
<h3 id="golang-checkins"><a href="http://groups.google.com/group/golang-checkins">Checkins Mailing List</a></h3>
|
||||
<p>A mailing list that receives a message summarizing each checkin to the Go repository.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="end-columns"></div>
|
||||
|
||||
|
||||
1162
doc/contribute.html
1162
doc/contribute.html
File diff suppressed because it is too large
Load Diff
@@ -1,518 +0,0 @@
|
||||
<!--{
|
||||
"Title": "Debugging Go Code with GDB",
|
||||
"Path": "/doc/gdb"
|
||||
}-->
|
||||
|
||||
<p><i>
|
||||
This applies to the standard toolchain (the <code>gc</code> Go
|
||||
compiler and tools). Gccgo has native gdb support.
|
||||
Besides this overview you might want to consult the
|
||||
<a href="http://sourceware.org/gdb/current/onlinedocs/gdb/">GDB manual</a>.
|
||||
</i></p>
|
||||
|
||||
<p>
|
||||
GDB does not understand Go programs well.
|
||||
The stack management, threading, and runtime contain aspects that differ
|
||||
enough from the execution model GDB expects that they can confuse
|
||||
the debugger, even when the program is compiled with gccgo.
|
||||
As a consequence, although GDB can be useful in some situations, it is
|
||||
not a reliable debugger for Go programs, particularly heavily concurrent ones.
|
||||
Moreover, it is not a priority for the Go project to address these issues, which
|
||||
are difficult.
|
||||
In short, the instructions below should be taken only as a guide to how
|
||||
to use GDB when it works, not as a guarantee of success.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In time, a more Go-centric debugging architecture may be required.
|
||||
</p>
|
||||
|
||||
<h2 id="Introduction">Introduction</h2>
|
||||
|
||||
<p>
|
||||
When you compile and link your Go programs with the <code>gc</code> toolchain
|
||||
on Linux, Mac OS X, FreeBSD or NetBSD, the resulting binaries contain DWARFv3
|
||||
debugging information that recent versions (>7.1) of the GDB debugger can
|
||||
use to inspect a live process or a core dump.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Pass the <code>'-w'</code> flag to the linker to omit the debug information
|
||||
(for example, <code>go build -ldflags "-w" prog.go</code>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The code generated by the <code>gc</code> compiler includes inlining of
|
||||
function invocations and registerization of variables. These optimizations
|
||||
can sometimes make debugging with <code>gdb</code> harder. To disable them
|
||||
when debugging, pass the flags <code>-gcflags "-N -l"</code> to the
|
||||
<a href="/cmd/go"><code>go</code></a> command used to build the code being
|
||||
debugged.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you want to use gdb to inspect a core dump, you can trigger a dump
|
||||
on a program crash, on systems that permit it, by setting
|
||||
<code>GOTRACEBACK=crash</code> in the environment (see the
|
||||
<a href="/pkg/runtime/#hdr-Environment_Variables"> runtime package
|
||||
documentation</a> for more info).
|
||||
</p>
|
||||
|
||||
<h3 id="Common_Operations">Common Operations</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Show file and line number for code, set breakpoints and disassemble:
|
||||
<pre>(gdb) <b>list</b>
|
||||
(gdb) <b>list <i>line</i></b>
|
||||
(gdb) <b>list <i>file.go</i>:<i>line</i></b>
|
||||
(gdb) <b>break <i>line</i></b>
|
||||
(gdb) <b>break <i>file.go</i>:<i>line</i></b>
|
||||
(gdb) <b>disas</b></pre>
|
||||
</li>
|
||||
<li>
|
||||
Show backtraces and unwind stack frames:
|
||||
<pre>(gdb) <b>bt</b>
|
||||
(gdb) <b>frame <i>n</i></b></pre>
|
||||
</li>
|
||||
<li>
|
||||
Show the name, type and location on the stack frame of local variables,
|
||||
arguments and return values:
|
||||
<pre>(gdb) <b>info locals</b>
|
||||
(gdb) <b>info args</b>
|
||||
(gdb) <b>p variable</b>
|
||||
(gdb) <b>whatis variable</b></pre>
|
||||
</li>
|
||||
<li>
|
||||
Show the name, type and location of global variables:
|
||||
<pre>(gdb) <b>info variables <i>regexp</i></b></pre>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3 id="Go_Extensions">Go Extensions</h3>
|
||||
|
||||
<p>
|
||||
A recent extension mechanism to GDB allows it to load extension scripts for a
|
||||
given binary. The tool chain uses this to extend GDB with a handful of
|
||||
commands to inspect internals of the runtime code (such as goroutines) and to
|
||||
pretty print the built-in map, slice and channel types.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Pretty printing a string, slice, map, channel or interface:
|
||||
<pre>(gdb) <b>p <i>var</i></b></pre>
|
||||
</li>
|
||||
<li>
|
||||
A $len() and $cap() function for strings, slices and maps:
|
||||
<pre>(gdb) <b>p $len(<i>var</i>)</b></pre>
|
||||
</li>
|
||||
<li>
|
||||
A function to cast interfaces to their dynamic types:
|
||||
<pre>(gdb) <b>p $dtype(<i>var</i>)</b>
|
||||
(gdb) <b>iface <i>var</i></b></pre>
|
||||
<p class="detail"><b>Known issue:</b> GDB can’t automatically find the dynamic
|
||||
type of an interface value if its long name differs from its short name
|
||||
(annoying when printing stacktraces, the pretty printer falls back to printing
|
||||
the short type name and a pointer).</p>
|
||||
</li>
|
||||
<li>
|
||||
Inspecting goroutines:
|
||||
<pre>(gdb) <b>info goroutines</b>
|
||||
(gdb) <b>goroutine <i>n</i> <i>cmd</i></b>
|
||||
(gdb) <b>help goroutine</b></pre>
|
||||
For example:
|
||||
<pre>(gdb) <b>goroutine 12 bt</b></pre>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
If you'd like to see how this works, or want to extend it, take a look at <a
|
||||
href="/src/runtime/runtime-gdb.py">src/runtime/runtime-gdb.py</a> in
|
||||
the Go source distribution. It depends on some special magic types
|
||||
(<code>hash<T,U></code>) and variables (<code>runtime.m</code> and
|
||||
<code>runtime.g</code>) that the linker
|
||||
(<a href="/src/cmd/link/internal/ld/dwarf.go">src/cmd/link/internal/ld/dwarf.go</a>) ensures are described in
|
||||
the DWARF code.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you're interested in what the debugging information looks like, run
|
||||
'<code>objdump -W a.out</code>' and browse through the <code>.debug_*</code>
|
||||
sections.
|
||||
</p>
|
||||
|
||||
|
||||
<h3 id="Known_Issues">Known Issues</h3>
|
||||
|
||||
<ol>
|
||||
<li>String pretty printing only triggers for type string, not for types derived
|
||||
from it.</li>
|
||||
<li>Type information is missing for the C parts of the runtime library.</li>
|
||||
<li>GDB does not understand Go’s name qualifications and treats
|
||||
<code>"fmt.Print"</code> as an unstructured literal with a <code>"."</code>
|
||||
that needs to be quoted. It objects even more strongly to method names of
|
||||
the form <code>pkg.(*MyType).Meth</code>.
|
||||
<li>All global variables are lumped into package <code>"main"</code>.</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="Tutorial">Tutorial</h2>
|
||||
|
||||
<p>
|
||||
In this tutorial we will inspect the binary of the
|
||||
<a href="/pkg/regexp/">regexp</a> package's unit tests. To build the binary,
|
||||
change to <code>$GOROOT/src/regexp</code> and run <code>go test -c</code>.
|
||||
This should produce an executable file named <code>regexp.test</code>.
|
||||
</p>
|
||||
|
||||
|
||||
<h3 id="Getting_Started">Getting Started</h3>
|
||||
|
||||
<p>
|
||||
Launch GDB, debugging <code>regexp.test</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>gdb regexp.test</b>
|
||||
GNU gdb (GDB) 7.2-gg8
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
License GPLv 3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
Type "show copying" and "show warranty" for licensing/warranty details.
|
||||
This GDB was configured as "x86_64-linux".
|
||||
|
||||
Reading symbols from /home/user/go/src/regexp/regexp.test...
|
||||
done.
|
||||
Loading Go Runtime support.
|
||||
(gdb)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The message <code>"Loading Go Runtime support"</code> means that GDB loaded the
|
||||
extension from <code>$GOROOT/src/runtime/runtime-gdb.py</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To help GDB find the Go runtime sources and the accompanying support script,
|
||||
pass your <code>$GOROOT</code> with the <code>'-d'</code> flag:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ <b>gdb regexp.test -d $GOROOT</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If for some reason GDB still can't find that directory or that script, you can load
|
||||
it by hand by telling gdb (assuming you have the go sources in
|
||||
<code>~/go/</code>):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>source ~/go/src/runtime/runtime-gdb.py</b>
|
||||
Loading Go Runtime support.
|
||||
</pre>
|
||||
|
||||
<h3 id="Inspecting_the_source">Inspecting the source</h3>
|
||||
|
||||
<p>
|
||||
Use the <code>"l"</code> or <code>"list"</code> command to inspect source code.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>l</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
List a specific part of the source parametrizing <code>"list"</code> with a
|
||||
function name (it must be qualified with its package name).
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>l main.main</b>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
List a specific file and line number:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>l regexp.go:1</b>
|
||||
(gdb) <i># Hit enter to repeat last command. Here, this lists next 10 lines.</i>
|
||||
</pre>
|
||||
|
||||
|
||||
<h3 id="Naming">Naming</h3>
|
||||
|
||||
<p>
|
||||
Variable and function names must be qualified with the name of the packages
|
||||
they belong to. The <code>Compile</code> function from the <code>regexp</code>
|
||||
package is known to GDB as <code>'regexp.Compile'</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Methods must be qualified with the name of their receiver types. For example,
|
||||
the <code>*Regexp</code> type’s <code>String</code> method is known as
|
||||
<code>'regexp.(*Regexp).String'</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Variables that shadow other variables are magically suffixed with a number in the debug info.
|
||||
Variables referenced by closures will appear as pointers magically prefixed with '&'.
|
||||
</p>
|
||||
|
||||
<h3 id="Setting_breakpoints">Setting breakpoints</h3>
|
||||
|
||||
<p>
|
||||
Set a breakpoint at the <code>TestFind</code> function:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>b 'regexp.TestFind'</b>
|
||||
Breakpoint 1 at 0x424908: file /home/user/go/src/regexp/find_test.go, line 148.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Run the program:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>run</b>
|
||||
Starting program: /home/user/go/src/regexp/regexp.test
|
||||
|
||||
Breakpoint 1, regexp.TestFind (t=0xf8404a89c0) at /home/user/go/src/regexp/find_test.go:148
|
||||
148 func TestFind(t *testing.T) {
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Execution has paused at the breakpoint.
|
||||
See which goroutines are running, and what they're doing:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>info goroutines</b>
|
||||
1 waiting runtime.gosched
|
||||
* 13 running runtime.goexit
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
the one marked with the <code>*</code> is the current goroutine.
|
||||
</p>
|
||||
|
||||
<h3 id="Inspecting_the_stack">Inspecting the stack</h3>
|
||||
|
||||
<p>
|
||||
Look at the stack trace for where we’ve paused the program:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>bt</b> <i># backtrace</i>
|
||||
#0 regexp.TestFind (t=0xf8404a89c0) at /home/user/go/src/regexp/find_test.go:148
|
||||
#1 0x000000000042f60b in testing.tRunner (t=0xf8404a89c0, test=0x573720) at /home/user/go/src/testing/testing.go:156
|
||||
#2 0x000000000040df64 in runtime.initdone () at /home/user/go/src/runtime/proc.c:242
|
||||
#3 0x000000f8404a89c0 in ?? ()
|
||||
#4 0x0000000000573720 in ?? ()
|
||||
#5 0x0000000000000000 in ?? ()
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The other goroutine, number 1, is stuck in <code>runtime.gosched</code>, blocked on a channel receive:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>goroutine 1 bt</b>
|
||||
#0 0x000000000040facb in runtime.gosched () at /home/user/go/src/runtime/proc.c:873
|
||||
#1 0x00000000004031c9 in runtime.chanrecv (c=void, ep=void, selected=void, received=void)
|
||||
at /home/user/go/src/runtime/chan.c:342
|
||||
#2 0x0000000000403299 in runtime.chanrecv1 (t=void, c=void) at/home/user/go/src/runtime/chan.c:423
|
||||
#3 0x000000000043075b in testing.RunTests (matchString={void (struct string, struct string, bool *, error *)}
|
||||
0x7ffff7f9ef60, tests= []testing.InternalTest = {...}) at /home/user/go/src/testing/testing.go:201
|
||||
#4 0x00000000004302b1 in testing.Main (matchString={void (struct string, struct string, bool *, error *)}
|
||||
0x7ffff7f9ef80, tests= []testing.InternalTest = {...}, benchmarks= []testing.InternalBenchmark = {...})
|
||||
at /home/user/go/src/testing/testing.go:168
|
||||
#5 0x0000000000400dc1 in main.main () at /home/user/go/src/regexp/_testmain.go:98
|
||||
#6 0x00000000004022e7 in runtime.mainstart () at /home/user/go/src/runtime/amd64/asm.s:78
|
||||
#7 0x000000000040ea6f in runtime.initdone () at /home/user/go/src/runtime/proc.c:243
|
||||
#8 0x0000000000000000 in ?? ()
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The stack frame shows we’re currently executing the <code>regexp.TestFind</code> function, as expected.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>info frame</b>
|
||||
Stack level 0, frame at 0x7ffff7f9ff88:
|
||||
rip = 0x425530 in regexp.TestFind (/home/user/go/src/regexp/find_test.go:148);
|
||||
saved rip 0x430233
|
||||
called by frame at 0x7ffff7f9ffa8
|
||||
source language minimal.
|
||||
Arglist at 0x7ffff7f9ff78, args: t=0xf840688b60
|
||||
Locals at 0x7ffff7f9ff78, Previous frame's sp is 0x7ffff7f9ff88
|
||||
Saved registers:
|
||||
rip at 0x7ffff7f9ff80
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The command <code>info locals</code> lists all variables local to the function and their values, but is a bit
|
||||
dangerous to use, since it will also try to print uninitialized variables. Uninitialized slices may cause gdb to try
|
||||
to print arbitrary large arrays.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The function’s arguments:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>info args</b>
|
||||
t = 0xf840688b60
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
When printing the argument, notice that it’s a pointer to a
|
||||
<code>Regexp</code> value. Note that GDB has incorrectly put the <code>*</code>
|
||||
on the right-hand side of the type name and made up a 'struct' keyword, in traditional C style.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>p re</b>
|
||||
(gdb) p t
|
||||
$1 = (struct testing.T *) 0xf840688b60
|
||||
(gdb) p t
|
||||
$1 = (struct testing.T *) 0xf840688b60
|
||||
(gdb) p *t
|
||||
$2 = {errors = "", failed = false, ch = 0xf8406f5690}
|
||||
(gdb) p *t->ch
|
||||
$3 = struct hchan<*testing.T>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
That <code>struct hchan<*testing.T></code> is the
|
||||
runtime-internal representation of a channel. It is currently empty,
|
||||
or gdb would have pretty-printed its contents.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Stepping forward:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>n</b> <i># execute next line</i>
|
||||
149 for _, test := range findTests {
|
||||
(gdb) <i># enter is repeat</i>
|
||||
150 re := MustCompile(test.pat)
|
||||
(gdb) <b>p test.pat</b>
|
||||
$4 = ""
|
||||
(gdb) <b>p re</b>
|
||||
$5 = (struct regexp.Regexp *) 0xf84068d070
|
||||
(gdb) <b>p *re</b>
|
||||
$6 = {expr = "", prog = 0xf840688b80, prefix = "", prefixBytes = []uint8, prefixComplete = true,
|
||||
prefixRune = 0, cond = 0 '\000', numSubexp = 0, longest = false, mu = {state = 0, sema = 0},
|
||||
machine = []*regexp.machine}
|
||||
(gdb) <b>p *re->prog</b>
|
||||
$7 = {Inst = []regexp/syntax.Inst = {{Op = 5 '\005', Out = 0, Arg = 0, Rune = []int}, {Op =
|
||||
6 '\006', Out = 2, Arg = 0, Rune = []int}, {Op = 4 '\004', Out = 0, Arg = 0, Rune = []int}},
|
||||
Start = 1, NumCap = 2}
|
||||
</pre>
|
||||
|
||||
|
||||
<p>
|
||||
We can step into the <code>String</code>function call with <code>"s"</code>:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>s</b>
|
||||
regexp.(*Regexp).String (re=0xf84068d070, noname=void) at /home/user/go/src/regexp/regexp.go:97
|
||||
97 func (re *Regexp) String() string {
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Get a stack trace to see where we are:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>bt</b>
|
||||
#0 regexp.(*Regexp).String (re=0xf84068d070, noname=void)
|
||||
at /home/user/go/src/regexp/regexp.go:97
|
||||
#1 0x0000000000425615 in regexp.TestFind (t=0xf840688b60)
|
||||
at /home/user/go/src/regexp/find_test.go:151
|
||||
#2 0x0000000000430233 in testing.tRunner (t=0xf840688b60, test=0x5747b8)
|
||||
at /home/user/go/src/testing/testing.go:156
|
||||
#3 0x000000000040ea6f in runtime.initdone () at /home/user/go/src/runtime/proc.c:243
|
||||
....
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Look at the source code:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>l</b>
|
||||
92 mu sync.Mutex
|
||||
93 machine []*machine
|
||||
94 }
|
||||
95
|
||||
96 // String returns the source text used to compile the regular expression.
|
||||
97 func (re *Regexp) String() string {
|
||||
98 return re.expr
|
||||
99 }
|
||||
100
|
||||
101 // Compile parses a regular expression and returns, if successful,
|
||||
</pre>
|
||||
|
||||
<h3 id="Pretty_Printing">Pretty Printing</h3>
|
||||
|
||||
<p>
|
||||
GDB's pretty printing mechanism is triggered by regexp matches on type names. An example for slices:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>p utf</b>
|
||||
$22 = []uint8 = {0 '\000', 0 '\000', 0 '\000', 0 '\000'}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Since slices, arrays and strings are not C pointers, GDB can't interpret the subscripting operation for you, but
|
||||
you can look inside the runtime representation to do that (tab completion helps here):
|
||||
</p>
|
||||
<pre>
|
||||
|
||||
(gdb) <b>p slc</b>
|
||||
$11 = []int = {0, 0}
|
||||
(gdb) <b>p slc-></b><i><TAB></i>
|
||||
array slc len
|
||||
(gdb) <b>p slc->array</b>
|
||||
$12 = (int *) 0xf84057af00
|
||||
(gdb) <b>p slc->array[1]</b>
|
||||
$13 = 0</pre>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
The extension functions $len and $cap work on strings, arrays and slices:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>p $len(utf)</b>
|
||||
$23 = 4
|
||||
(gdb) <b>p $cap(utf)</b>
|
||||
$24 = 4
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Channels and maps are 'reference' types, which gdb shows as pointers to C++-like types <code>hash<int,string>*</code>. Dereferencing will trigger prettyprinting
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Interfaces are represented in the runtime as a pointer to a type descriptor and a pointer to a value. The Go GDB runtime extension decodes this and automatically triggers pretty printing for the runtime type. The extension function <code>$dtype</code> decodes the dynamic type for you (examples are taken from a breakpoint at <code>regexp.go</code> line 293.)
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
(gdb) <b>p i</b>
|
||||
$4 = {str = "cbb"}
|
||||
(gdb) <b>whatis i</b>
|
||||
type = regexp.input
|
||||
(gdb) <b>p $dtype(i)</b>
|
||||
$26 = (struct regexp.inputBytes *) 0xf8400b4930
|
||||
(gdb) <b>iface i</b>
|
||||
regexp.input: struct regexp.inputBytes *
|
||||
</pre>
|
||||
11
doc/devel/index.html
Normal file
11
doc/devel/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!-- The Go project -->
|
||||
|
||||
<ul>
|
||||
<li><a href="roadmap.html">Roadmap</a></li>
|
||||
<li><a href="release.html">Release history</a></li>
|
||||
<li><a href="weekly.html">Weekly snapshot history</a></li>
|
||||
<li><a href="http://godashboard.appspot.com">Build and benchmark status</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../contribute.html">Contributing code</a></li>
|
||||
</ul>
|
||||
@@ -1,455 +0,0 @@
|
||||
<!--{
|
||||
"Title": "Pre-Go 1 Release History"
|
||||
}-->
|
||||
|
||||
<p>
|
||||
This page summarizes the changes between stable releases of Go prior to Go 1.
|
||||
See the <a href="release.html">Release History</a> page for notes on recent releases.
|
||||
</p>
|
||||
|
||||
<h2 id="r60">r60 (released 2011/09/07)</h2>
|
||||
|
||||
<p>
|
||||
The r60 release corresponds to
|
||||
<code><a href="weekly.html#2011-08-17">weekly.2011-08-17</a></code>.
|
||||
This section highlights the most significant changes in this release.
|
||||
For a more detailed summary, see the
|
||||
<a href="weekly.html#2011-08-17">weekly release notes</a>.
|
||||
For complete information, see the
|
||||
<a href="//code.google.com/p/go/source/list?r=release-branch.r60">Mercurial change list</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="r60.lang">Language</h3>
|
||||
|
||||
<p>
|
||||
An "else" block is now required to have braces except if the body of the "else"
|
||||
is another "if". Since gofmt always puts those braces in anyway,
|
||||
gofmt-formatted programs will not be affected.
|
||||
To fix other programs, run gofmt.
|
||||
</p>
|
||||
|
||||
<h3 id="r60.pkg">Packages</h3>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/http/">Package http</a>'s URL parsing and query escaping code
|
||||
(such as <code>ParseURL</code> and <code>URLEscape</code>) has been moved to
|
||||
the new <a href="/pkg/url/">url package</a>, with several simplifications to
|
||||
the names. Client code can be updated automatically with gofix.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/image/">Package image</a> has had significant changes made to the
|
||||
<code>Pix</code> field of struct types such as
|
||||
<a href="/pkg/image/#RGBA">image.RGBA</a> and
|
||||
<a href="/pkg/image/#NRGBA">image.NRGBA</a>.
|
||||
The <a href="/pkg/image/#Image">image.Image</a> interface type has not changed,
|
||||
though, and you should not need to change your code if you don't explicitly
|
||||
refer to <code>Pix</code> fields. For example, if you decode a number of images
|
||||
using the <a href="/pkg/image/jpeg/">image/jpeg</a> package, compose them using
|
||||
<a href="/pkg/image/draw/">image/draw</a>, and then encode the result using
|
||||
<a href="/pkg/img/png">image/png</a>, then your code should still work as
|
||||
before.
|
||||
If your code <i>does</i> refer to <code>Pix</code> fields see the
|
||||
<a href="/doc/devel/weekly.html#2011-07-19">weekly.2011-07-19</a>
|
||||
snapshot notes for how to update your code.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/template/">Package template</a> has been replaced with a new
|
||||
templating package (formerly <code>exp/template</code>). The original template
|
||||
package is still available as <a href="/pkg/old/template/">old/template</a>.
|
||||
The <code>old/template</code> package is deprecated and will be removed.
|
||||
The Go tree has been updated to use the new template package. We encourage
|
||||
users of the old template package to switch to the new one. Code that uses
|
||||
<code>template</code> or <code>exp/template</code> will need to change its
|
||||
import lines to <code>"old/template"</code> or <code>"template"</code>,
|
||||
respectively.
|
||||
</p>
|
||||
|
||||
<h3 id="r60.cmd">Tools</h3>
|
||||
|
||||
<p>
|
||||
<a href="/cmd/goinstall/">Goinstall</a> now uses a new tag selection scheme.
|
||||
When downloading or updating, goinstall looks for a tag or branch with the
|
||||
<code>"go."</code> prefix that corresponds to the local Go version. For Go
|
||||
<code>release.r58</code> it looks for <code>go.r58</code>. For
|
||||
<code>weekly.2011-06-03</code> it looks for <code>go.weekly.2011-06-03</code>.
|
||||
If the specific <code>go.X</code> tag or branch is not found, it chooses the
|
||||
closest earlier version. If an appropriate tag or branch is found, goinstall
|
||||
uses that version of the code. Otherwise it uses the default version selected
|
||||
by the version control system. Library authors are encouraged to use the
|
||||
appropriate tag or branch names in their repositories to make their libraries
|
||||
more accessible.
|
||||
</p>
|
||||
|
||||
<h3 id="r60.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
r60.1 includes a
|
||||
<a href="//golang.org/change/1824581bf62d">linker
|
||||
fix</a>, a pair of
|
||||
<a href="//golang.org/change/9ef4429c2c64">goplay</a>
|
||||
<a href="//golang.org/change/d42ed8c3098e">fixes</a>,
|
||||
and a <code>json</code> package
|
||||
<a href="//golang.org/change/d5e97874fe84">fix</a> and
|
||||
a new
|
||||
<a href="//golang.org/change/4f0e6269213f">struct tag
|
||||
option</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
r60.2
|
||||
<a href="//golang.org/change/ff19536042ac">fixes</a>
|
||||
a memory leak involving maps.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
r60.3 fixes a
|
||||
<a href="//golang.org/change/01fa62f5e4e5">reflect bug</a>.
|
||||
</p>
|
||||
|
||||
<h2 id="r59">r59 (released 2011/08/01)</h2>
|
||||
|
||||
<p>
|
||||
The r59 release corresponds to
|
||||
<code><a href="weekly.html#2011-07-07">weekly.2011-07-07</a></code>.
|
||||
This section highlights the most significant changes in this release.
|
||||
For a more detailed summary, see the
|
||||
<a href="weekly.html#2011-07-07">weekly release notes</a>.
|
||||
For complete information, see the
|
||||
<a href="//code.google.com/p/go/source/list?r=release-branch.r59">Mercurial change list</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="r59.lang">Language</h3>
|
||||
|
||||
<p>
|
||||
This release includes a language change that restricts the use of
|
||||
<code>goto</code>. In essence, a <code>goto</code> statement outside a block
|
||||
cannot jump to a label inside that block. Your code may require changes if it
|
||||
uses <code>goto</code>.
|
||||
See <a href="//golang.org/change/dc6d3cf9279d">this
|
||||
changeset</a> for how the new rule affected the Go tree.
|
||||
</p>
|
||||
|
||||
<h3 id="r59.pkg">Packages</h3>
|
||||
|
||||
<p>
|
||||
As usual, <a href="/cmd/gofix/">gofix</a> will handle the bulk of the rewrites
|
||||
necessary for these changes to package APIs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/http">Package http</a> has a new
|
||||
<a href="/pkg/http/#FileSystem">FileSystem</a> interface that provides access
|
||||
to files. The <a href="/pkg/http/#FileServer">FileServer</a> helper now takes a
|
||||
<code>FileSystem</code> argument instead of an explicit file system root. By
|
||||
implementing your own <code>FileSystem</code> you can use the
|
||||
<code>FileServer</code> to serve arbitrary data.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/os/">Package os</a>'s <code>ErrorString</code> type has been
|
||||
hidden. Most uses of <code>os.ErrorString</code> can be replaced with
|
||||
<a href="/pkg/os/#NewError">os.NewError</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/reflect/">Package reflect</a> supports a new struct tag scheme
|
||||
that enables sharing of struct tags between multiple packages.
|
||||
In this scheme, the tags must be of the form:
|
||||
</p>
|
||||
<pre>
|
||||
`key:"value" key2:"value2"`
|
||||
</pre>
|
||||
<p>
|
||||
The <a href="/pkg/reflect/#StructField">StructField</a> type's Tag field now
|
||||
has type <a href="/pkg/reflect/#StructTag">StructTag</a>, which has a
|
||||
<code>Get</code> method. Clients of <a href="/pkg/json">json</a> and
|
||||
<a href="/pkg/xml">xml</a> will need to be updated. Code that says
|
||||
</p>
|
||||
<pre>
|
||||
type T struct {
|
||||
X int "name"
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
should become
|
||||
</p>
|
||||
<pre>
|
||||
type T struct {
|
||||
X int `json:"name"` // or `xml:"name"`
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
Use <a href="/cmd/govet/">govet</a> to identify struct tags that need to be
|
||||
changed to use the new syntax.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/sort/">Package sort</a>'s <code>IntArray</code> type has been
|
||||
renamed to <a href="/pkg/sort/#IntSlice">IntSlice</a>, and similarly for
|
||||
<a href="/pkg/sort/#Float64Slice">Float64Slice</a> and
|
||||
<a href="/pkg/sort/#StringSlice">StringSlice</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/strings/">Package strings</a>'s <code>Split</code> function has
|
||||
itself been split into <a href="/pkg/strings/#Split">Split</a> and
|
||||
<a href="/pkg/strings/#SplitN">SplitN</a>.
|
||||
<code>SplitN</code> is the same as the old <code>Split</code>.
|
||||
The new <code>Split</code> is equivalent to <code>SplitN</code> with a final
|
||||
argument of -1.
|
||||
</p>
|
||||
|
||||
<a href="/pkg/image/draw/">Package image/draw</a>'s
|
||||
<a href="/pkg/image/draw/#Draw">Draw</a> function now takes an additional
|
||||
argument, a compositing operator.
|
||||
If in doubt, use <a href="/pkg/image/draw/#Op">draw.Over</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="r59.cmd">Tools</h3>
|
||||
|
||||
<p>
|
||||
<a href="/cmd/goinstall/">Goinstall</a> now installs packages and commands from
|
||||
arbitrary remote repositories (not just Google Code, Github, and so on).
|
||||
See the <a href="/cmd/goinstall/">goinstall documentation</a> for details.
|
||||
</p>
|
||||
|
||||
<h2 id="r58">r58 (released 2011/06/29)</h2>
|
||||
|
||||
<p>
|
||||
The r58 release corresponds to
|
||||
<code><a href="weekly.html#2011-06-09">weekly.2011-06-09</a></code>
|
||||
with additional bug fixes.
|
||||
This section highlights the most significant changes in this release.
|
||||
For a more detailed summary, see the
|
||||
<a href="weekly.html#2011-06-09">weekly release notes</a>.
|
||||
For complete information, see the
|
||||
<a href="//code.google.com/p/go/source/list?r=release-branch.r58">Mercurial change list</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="r58.lang">Language</h3>
|
||||
|
||||
<p>
|
||||
This release fixes a <a href="//golang.org/change/b720749486e1">use of uninitialized memory in programs that misuse <code>goto</code></a>.
|
||||
</p>
|
||||
|
||||
<h3 id="r58.pkg">Packages</h3>
|
||||
|
||||
<p>
|
||||
As usual, <a href="/cmd/gofix/">gofix</a> will handle the bulk of the rewrites
|
||||
necessary for these changes to package APIs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/http/">Package http</a> drops the <code>finalURL</code> return
|
||||
value from the <a href="/pkg/http/#Client.Get">Client.Get</a> method. The value
|
||||
is now available via the new <code>Request</code> field on <a
|
||||
href="/pkg/http/#Response">http.Response</a>.
|
||||
Most instances of the type map[string][]string in have been
|
||||
replaced with the new <a href="/pkg/http/#Values">Values</a> type.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/exec/">Package exec</a> has been redesigned with a more
|
||||
convenient and succinct API.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/strconv/">Package strconv</a>'s <a href="/pkg/strconv/#Quote">Quote</a>
|
||||
function now escapes only those Unicode code points not classified as printable
|
||||
by <a href="/pkg/unicode/#IsPrint">unicode.IsPrint</a>.
|
||||
Previously Quote would escape all non-ASCII characters.
|
||||
This also affects the <a href="/pkg/fmt/">fmt</a> package's <code>"%q"</code>
|
||||
formatting directive. The previous quoting behavior is still available via
|
||||
strconv's new <a href="/pkg/strconv/#QuoteToASCII">QuoteToASCII</a> function.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/os/signal/">Package os/signal</a>'s
|
||||
<a href="/pkg/os/#Signal">Signal</a> and
|
||||
<a href="/pkg/os/#UnixSignal">UnixSignal</a> types have been moved to the
|
||||
<a href="/pkg/os/">os</a> package.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/image/draw/">Package image/draw</a> is the new name for
|
||||
<code>exp/draw</code>. The GUI-related code from <code>exp/draw</code> is now
|
||||
located in the <a href="/pkg/exp/gui/">exp/gui</a> package.
|
||||
</p>
|
||||
|
||||
<h3 id="r58.cmd">Tools</h3>
|
||||
|
||||
<p>
|
||||
<a href="/cmd/goinstall/">Goinstall</a> now observes the GOPATH environment
|
||||
variable to build and install your own code and external libraries outside of
|
||||
the Go tree (and avoid writing Makefiles).
|
||||
</p>
|
||||
|
||||
|
||||
<h3 id="r58.minor">Minor revisions</h3>
|
||||
|
||||
<p>r58.1 adds
|
||||
<a href="//golang.org/change/293c25943586">build</a> and
|
||||
<a href="//golang.org/change/bf17e96b6582">runtime</a>
|
||||
changes to make Go run on OS X 10.7 Lion.
|
||||
</p>
|
||||
|
||||
<h2 id="r57">r57 (released 2011/05/03)</h2>
|
||||
|
||||
<p>
|
||||
The r57 release corresponds to
|
||||
<code><a href="weekly.html#2011-04-27">weekly.2011-04-27</a></code>
|
||||
with additional bug fixes.
|
||||
This section highlights the most significant changes in this release.
|
||||
For a more detailed summary, see the
|
||||
<a href="weekly.html#2011-04-27">weekly release notes</a>.
|
||||
For complete information, see the
|
||||
<a href="//code.google.com/p/go/source/list?r=release-branch.r57">Mercurial change list</a>.
|
||||
</p>
|
||||
|
||||
<p>The new <a href="/cmd/gofix">gofix</a> tool finds Go programs that use old APIs and rewrites them to use
|
||||
newer ones. After you update to a new Go release, gofix helps make the
|
||||
necessary changes to your programs. Gofix will handle the http, os, and syscall
|
||||
package changes described below, and we will update the program to keep up with
|
||||
future changes to the libraries.
|
||||
Gofix can’t
|
||||
handle all situations perfectly, so read and test the changes it makes before
|
||||
committing them.
|
||||
See <a href="//blog.golang.org/2011/04/introducing-gofix.html">the gofix blog post</a> for more
|
||||
information.</p>
|
||||
|
||||
<h3 id="r57.lang">Language</h3>
|
||||
|
||||
<p>
|
||||
<a href="/doc/go_spec.html#Receive_operator">Multiple assignment syntax</a> replaces the <code>closed</code> function.
|
||||
The syntax for channel
|
||||
receives allows an optional second assigned value, a boolean value
|
||||
indicating whether the channel is closed. This code:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
v := <-ch
|
||||
if closed(ch) {
|
||||
// channel is closed
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>should now be written as:</p>
|
||||
|
||||
<pre>
|
||||
v, ok := <-ch
|
||||
if !ok {
|
||||
// channel is closed
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p><a href="/doc/go_spec.html#Label_scopes">Unused labels are now illegal</a>, just as unused local variables are.</p>
|
||||
|
||||
<h3 id="r57.pkg">Packages</h3>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/gob/">Package gob</a> will now encode and decode values of types that implement the
|
||||
<a href="/pkg/gob/#GobEncoder">GobEncoder</a> and
|
||||
<a href="/pkg/gob/#GobDecoder">GobDecoder</a> interfaces. This allows types with unexported
|
||||
fields to transmit self-consistent descriptions; examples include
|
||||
<a href="/pkg/big/#Int.GobDecode">big.Int</a> and <a href="/pkg/big/#Rat.GobDecode">big.Rat</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/http/">Package http</a> has been redesigned.
|
||||
For clients, there are new
|
||||
<a href="/pkg/http/#Client">Client</a> and <a href="/pkg/http/#Transport">Transport</a>
|
||||
abstractions that give more control over HTTP details such as headers sent
|
||||
and redirections followed. These abstractions make it easy to implement
|
||||
custom clients that add functionality such as <a href="//code.google.com/p/goauth2/source/browse/oauth/oauth.go">OAuth2</a>.
|
||||
For servers, <a href="/pkg/http/#ResponseWriter">ResponseWriter</a>
|
||||
has dropped its non-essential methods.
|
||||
The Hijack and Flush methods are no longer required;
|
||||
code can test for them by checking whether a specific value implements
|
||||
<a href="/pkg/http/#Hijacker">Hijacker</a> or <a href="/pkg/http/#Flusher">Flusher</a>.
|
||||
The RemoteAddr and UsingTLS methods are replaced by <a href="/pkg/http/#Request">Request</a>'s
|
||||
RemoteAddr and TLS fields.
|
||||
The SetHeader method is replaced by a Header method;
|
||||
its result, of type <a href="/pkg/http/#Header">Header</a>,
|
||||
implements Set and other methods.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/net/">Package net</a>
|
||||
drops the <code>laddr</code> argument from <a href="/pkg/net/#Conn.Dial">Dial</a>
|
||||
and drops the <code>cname</code> return value
|
||||
from <a href="/pkg/net/#LookupHost">LookupHost</a>.
|
||||
The implementation now uses <a href="/cmd/cgo/">cgo</a> to implement
|
||||
network name lookups using the C library getaddrinfo(3)
|
||||
function when possible. This ensures that Go and C programs
|
||||
resolve names the same way and also avoids the OS X
|
||||
application-level firewall.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/os/">Package os</a>
|
||||
introduces simplified <a href="/pkg/os/#File.Open">Open</a>
|
||||
and <a href="/pkg/os/#File.Create">Create</a> functions.
|
||||
The original Open is now available as <a href="/pkg/os/#File.OpenFile">OpenFile</a>.
|
||||
The final three arguments to <a href="/pkg/os/#Process.StartProcess">StartProcess</a>
|
||||
have been replaced by a pointer to a <a href="/pkg/os/#ProcAttr">ProcAttr</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/reflect/">Package reflect</a> has been redesigned.
|
||||
<a href="/pkg/reflect/#Type">Type</a> is now an interface that implements
|
||||
all the possible type methods.
|
||||
Instead of a type switch on a Type <code>t</code>, switch on <code>t.Kind()</code>.
|
||||
<a href="/pkg/reflect/#Value">Value</a> is now a struct value that
|
||||
implements all the possible value methods.
|
||||
Instead of a type switch on a Value <code>v</code>, switch on <code>v.Kind()</code>.
|
||||
Typeof and NewValue are now called <a href="/pkg/reflect/#Type.TypeOf">TypeOf</a> and <a href="/pkg/reflect/#Value.ValueOf">ValueOf</a>
|
||||
To create a writable Value, use <code>New(t).Elem()</code> instead of <code>Zero(t)</code>.
|
||||
See <a href="//golang.org/change/843855f3c026">the change description</a>
|
||||
for the full details.
|
||||
The new API allows a more efficient implementation of Value
|
||||
that avoids many of the allocations required by the previous API.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Remember that gofix will handle the bulk of the rewrites
|
||||
necessary for these changes to package APIs.
|
||||
</p>
|
||||
|
||||
<h3 id="r57.cmd">Tools</h3>
|
||||
|
||||
<p><a href="/cmd/gofix/">Gofix</a>, a new command, is described above.</p>
|
||||
|
||||
<p>
|
||||
<a href="/cmd/gotest/">Gotest</a> is now a Go program instead of a shell script.
|
||||
The new <code>-test.short</code> flag in combination with package testing's Short function
|
||||
allows you to write tests that can be run in normal or “short” mode;
|
||||
all.bash runs tests in short mode to reduce installation time.
|
||||
The Makefiles know about the flag: use <code>make testshort</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The run-time support now implements CPU and memory profiling.
|
||||
Gotest's new
|
||||
<a href="/cmd/gotest/"><code>-test.cpuprofile</code> and
|
||||
<code>-test.memprofile</code> flags</a> make it easy to
|
||||
profile tests.
|
||||
To add profiling to your web server, see the <a href="/pkg/http/pprof/">http/pprof</a>
|
||||
documentation.
|
||||
For other uses, see the <a href="/pkg/runtime/pprof/">runtime/pprof</a> documentation.
|
||||
</p>
|
||||
|
||||
<h3 id="r57.minor">Minor revisions</h3>
|
||||
|
||||
<p>r57.1 fixes a <a href="//golang.org/change/ff2bc62726e7145eb2ecc1e0f076998e4a8f86f0">nil pointer dereference in http.FormFile</a>.</p>
|
||||
<p>r57.2 fixes a <a href="//golang.org/change/063b0ff67d8277df03c956208abc068076818dae">use of uninitialized memory in programs that misuse <code>goto</code></a>.</p>
|
||||
|
||||
<h2 id="r56">r56 (released 2011/03/16)</h2>
|
||||
|
||||
<p>
|
||||
The r56 release was the first stable release and corresponds to
|
||||
<code><a href="weekly.html#2011-03-07">weekly.2011-03-07.1</a></code>.
|
||||
The numbering starts at 56 because before this release,
|
||||
what we now consider weekly snapshots were called releases.
|
||||
</p>
|
||||
@@ -1,339 +1,169 @@
|
||||
<!--{
|
||||
"Title": "Release History"
|
||||
}-->
|
||||
<!-- Release History -->
|
||||
|
||||
<p>This page summarizes the changes between official stable releases of Go.
|
||||
The <a href="//golang.org/change">change log</a> has the full details.</p>
|
||||
Between releases we issue less stable
|
||||
<a href="http://blog.golang.org/2011/03/go-becomes-more-stable.html">weekly snapshots</a>.
|
||||
The <a href="weekly.html">weekly snapshot history</a> contains more detail,
|
||||
and the <a href="http://code.google.com/p/go/source/list">Mercurial change log</a>
|
||||
has full details.</p>
|
||||
|
||||
<p>To update to a specific release, use:</p>
|
||||
|
||||
<pre>
|
||||
git pull
|
||||
git checkout <i>release-branch</i>
|
||||
hg pull
|
||||
hg update release.r<i>NN</i>
|
||||
</pre>
|
||||
|
||||
<h2 id="policy">Release Policy</h2>
|
||||
<h2 id="r57">r57 (released 2011/05/03)</h2>
|
||||
|
||||
<p>
|
||||
Each major Go release obsoletes and ends support for the previous one.
|
||||
For example, if Go 1.5 has been released, then it is the current release
|
||||
and Go 1.4 and earlier are no longer supported.
|
||||
We fix critical problems in the current release as needed by issuing minor revisions
|
||||
(for example, Go 1.5.1, Go 1.5.2, and so on).
|
||||
The r57 release corresponds to
|
||||
<code><a href="weekly.html#2011-04-27">weekly.2011-04-27</a></code>
|
||||
with additional bug fixes.
|
||||
This section highlights the most significant changes in this release.
|
||||
For a more detailed summary, see the
|
||||
The <a href="weekly.html#2011-04-27">weekly release notes</a>.
|
||||
For complete information, see the
|
||||
<a href="http://code.google.com/p/go/source/list?r=release-branch.r57">Mercurial change list</a>.
|
||||
</p>
|
||||
|
||||
<p>The new <a href="/cmd/gofix">gofix</a> tool finds Go programs that use old APIs and rewrites them to use
|
||||
newer ones. After you update to a new Go release, gofix helps make the
|
||||
necessary changes to your programs. Gofix will handle the http, os, and syscall
|
||||
package changes described below, and we will update the program to keep up with
|
||||
future changes to the libraries.
|
||||
Gofix can’t
|
||||
handle all situations perfectly, so read and test the changes it makes before
|
||||
committing them.
|
||||
See <a href="http://blog.golang.org/2011/04/introducing-gofix.html">the gofix blog post</a> for more
|
||||
information.</p>
|
||||
|
||||
<h3 id="r57.lang">Language</h3>
|
||||
|
||||
<p>
|
||||
<a href="/doc/go_spec.html#Receive_operator">Multiple assignment syntax</a> replaces the <code>closed</code> function.
|
||||
The syntax for channel
|
||||
receives allows an optional second assigned value, a boolean value
|
||||
indicating whether the channel is closed. This code:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
v := <-ch
|
||||
if closed(ch) {
|
||||
// channel is closed
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>should now be written as:</p>
|
||||
|
||||
<pre>
|
||||
v, ok := <-ch
|
||||
if !ok {
|
||||
// channel is closed
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p><a href="/doc/go_spec.html#Label_scopes">Unused labels are now illegal</a>, just as unused local variables are.</p>
|
||||
|
||||
<h3 id="r57.pkg">Packages</h3>
|
||||
|
||||
<p>
|
||||
<a href="/pkg/gob/">Package gob</a> will now encode and decode values of types that implement the
|
||||
<a href="/pkg/gob/#GobEncoder">GobEncoder</a> and
|
||||
<a href="/pkg/gob/#GobDecoder">GobDecoder</a> interfaces. This allows types with unexported
|
||||
fields to transmit self-consistent descriptions; examples include
|
||||
<a href="/pkg/big/#Int.GobDecode">big.Int</a> and <a href="/pkg/big/#Rat.GobDecode">big.Rat</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As a special case, we issue minor revisions for critical security problems
|
||||
in both the current release and the previous release.
|
||||
For example, if Go 1.5 is the current release then we will issue minor revisions
|
||||
to fix critical security problems in both Go 1.4 and Go 1.5 as they arise.
|
||||
See the <a href="/security">security policy</a> for more details.
|
||||
</p>
|
||||
|
||||
<h2 id="go1.8">go1.8 (released 2017/02/16)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.8 is a major release of Go.
|
||||
Read the <a href="/doc/go1.8">Go 1.8 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.8.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.8.1 (released 2017/04/07) includes fixes to the compiler, linker, runtime,
|
||||
documentation, <code>go</code> command and the <code>crypto/tls</code>,
|
||||
<code>encoding/xml</code>, <code>image/png</code>, <code>net</code>,
|
||||
<code>net/http</code>, <code>reflect</code>, <code>text/template</code>,
|
||||
and <code>time</code> packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.8.1">Go
|
||||
1.8.1 milestone</a> on our issue tracker for details.
|
||||
<a href="/pkg/http/">Package http</a> has been redesigned.
|
||||
For clients, there are new
|
||||
<a href="/pkg/http/#Client">Client</a> and <a href="/pkg/http/#Transport">Transport</a>
|
||||
abstractions that give more control over HTTP details such as headers sent
|
||||
and redirections followed. These abstractions make it easy to implement
|
||||
custom clients that add functionality such as <a href="http://code.google.com/p/goauth2/source/browse/oauth/oauth.go">OAuth2</a>.
|
||||
For servers, <a href="/pkg/http/#ResponseWriter">ResponseWriter</a>
|
||||
has dropped its non-essential methods.
|
||||
The Hijack and Flush methods are no longer required;
|
||||
code can test for them by checking whether a specific value implements
|
||||
<a href="/pkg/http/#Hijacker">Hijacker</a> or <a href="/pkg/http/#Flusher">Flusher</a>.
|
||||
The RemoteAddr and UsingTLS methods are replaced by <a href="/pkg/http/#Request">Request</a>'s
|
||||
RemoteAddr and TLS fields.
|
||||
The SetHeader method is replaced by a Header method;
|
||||
its result, of type <a href="/pkg/http/#Header">Header</a>,
|
||||
implements Set and other methods.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.8.2 (released 2017/05/23) includes a security fix to the
|
||||
<code>crypto/elliptic</code> package.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.8.2">Go
|
||||
1.8.2 milestone</a> on our issue tracker for details.
|
||||
<a href="/pkg/net/">Package net</a>
|
||||
drops the <code>laddr</code> argument from <a href="/pkg/net/#Conn.Dial">Dial</a>
|
||||
and drops the <code>cname</code> return value
|
||||
from <a href="/pkg/net/#LookupHost">LookupHost</a>.
|
||||
The implementation now uses <a href="/cmd/cgo/">cgo</a> to implement
|
||||
network name lookups using the C library getaddrinfo(3)
|
||||
function when possible. This ensures that Go and C programs
|
||||
resolve names the same way and also avoids the OS X
|
||||
application-level firewall.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.8.3 (released 2017/05/24) includes fixes to the compiler, runtime,
|
||||
documentation, and the <code>database/sql</code> package.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.8.3">Go
|
||||
1.8.3 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<h2 id="go1.7">go1.7 (released 2016/08/15)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.7 is a major release of Go.
|
||||
Read the <a href="/doc/go1.7">Go 1.7 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.7.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.7.1 (released 2016/09/07) includes fixes to the compiler, runtime,
|
||||
documentation, and the <code>compress/flate</code>, <code>hash/crc32</code>,
|
||||
<code>io</code>, <code>net</code>, <code>net/http</code>,
|
||||
<code>path/filepath</code>, <code>reflect</code>, and <code>syscall</code>
|
||||
packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.7.1">Go
|
||||
1.7.1 milestone</a> on our issue tracker for details.
|
||||
<a href="/pkg/os/">Package os</a>
|
||||
introduces simplified <a href="/pkg/os/#File.Open">Open</a>
|
||||
and <a href="/pkg/os/#File.Create">Create</a> functions.
|
||||
The original Open is now available as <a href="/pkg/os/#File.OpenFile">OpenFile</a>.
|
||||
The final three arguments to <a href="/pkg/os/#Process.StartProcess">StartProcess</a>
|
||||
have been replaced by a pointer to a <a href="/pkg/os/#ProcAttr">ProcAttr</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.7.2 should not be used. It was tagged but not fully released.
|
||||
The release was deferred due to a last minute bug report.
|
||||
Use go1.7.3 instead, and refer to the summary of changes below.
|
||||
<a href="/pkg/reflect/">Package reflect</a> has been redesigned.
|
||||
<a href="/pkg/reflect/#Type">Type</a> is now an interface that implements
|
||||
all the possible type methods.
|
||||
Instead of a type switch on a Type <code>t</code>, switch on <code>t.Kind()</code>.
|
||||
<a href="/pkg/reflect/#Value">Value</a> is now a struct value that
|
||||
implements all the possible value methods.
|
||||
Instead of a type switch on a Value <code>v</code>, switch on <code>v.Kind()</code>.
|
||||
Typeof and NewValue are now called <a href="/pkg/reflect/#Type.TypeOf">TypeOf</a> and <a href="/pkg/reflect/#Value.ValueOf">ValueOf</a>
|
||||
To create a writable Value, use <code>New(t).Elem()</code> instead of <code>Zero(t)</code>.
|
||||
See <a href="http://code.google.com/p/go/source/detail?r=843855f3c026">the change description</a>
|
||||
for the full details.
|
||||
The new API allows a more efficient implementation of Value
|
||||
that avoids many of the allocations required by the previous API.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.7.3 (released 2016/10/19) includes fixes to the compiler, runtime,
|
||||
and the <code>crypto/cipher</code>, <code>crypto/tls</code>,
|
||||
<code>net/http</code>, and <code>strings</code> packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.7.3">Go
|
||||
1.7.3 milestone</a> on our issue tracker for details.
|
||||
Remember that gofix will handle the bulk of the rewrites
|
||||
necessary for these changes to package APIs.
|
||||
</p>
|
||||
|
||||
<h3 id="r57.tool">Tools</h3>
|
||||
|
||||
<p><a href="/cmd/gofix/">Gofix</a>, a new command, is described above.</p>
|
||||
|
||||
<p>
|
||||
<a href="/cmd/gotest/">Gotest</a> is now a Go program instead of a shell script.
|
||||
The new <code>-test.short</code> flag in combination with package testing's Short function
|
||||
allows you to write tests that can be run in normal or “short” mode;
|
||||
all.bash runs tests in short mode to reduce installation time.
|
||||
The Makefiles know about the flag: use <code>make testshort</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.7.4 (released 2016/12/01) includes two security fixes.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.7.4">Go
|
||||
1.7.4 milestone</a> on our issue tracker for details.
|
||||
The run-time support now implements CPU and memory profiling.
|
||||
Gotest's new
|
||||
<a href="/cmd/gotest/"><code>-test.cpuprofile</code> and
|
||||
<code>-test.memprofile</code> flags</a> make it easy to
|
||||
profile tests.
|
||||
To add profiling to your web server, see the <a href="/pkg/http/pprof/">http/pprof</a>
|
||||
documentation.
|
||||
For other uses, see the <a href="/pkg/runtime/pprof/">runtime/pprof</a> documentation.
|
||||
</p>
|
||||
|
||||
<h2 id="r56">r56 (released 2011/03/16)</h2>
|
||||
|
||||
<p>
|
||||
go1.7.5 (released 2017/01/26) includes fixes to the compiler, runtime,
|
||||
and the <code>crypto/x509</code> and <code>time</code> packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.7.5">Go
|
||||
1.7.5 milestone</a> on our issue tracker for details.
|
||||
The r56 release was the first stable release and corresponds to
|
||||
<code><a href="weekly.html#2011-03-07">weekly.2011-03-07.1</a></code>.
|
||||
The numbering starts at 56 because before this release,
|
||||
what we now consider weekly snapshots were called releases.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.7.6 (released 2017/05/23) includes the same security fix as Go 1.8.2 and
|
||||
was released at the same time.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.8.2">Go
|
||||
1.8.2 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<h2 id="go1.6">go1.6 (released 2016/02/17)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.6 is a major release of Go.
|
||||
Read the <a href="/doc/go1.6">Go 1.6 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.6.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.6.1 (released 2016/04/12) includes two security fixes.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.6.1">Go
|
||||
1.6.1 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.6.2 (released 2016/04/20) includes fixes to the compiler, runtime, tools,
|
||||
documentation, and the <code>mime/multipart</code>, <code>net/http</code>, and
|
||||
<code>sort</code> packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.6.2">Go
|
||||
1.6.2 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.6.3 (released 2016/07/17) includes security fixes to the
|
||||
<code>net/http/cgi</code> package and <code>net/http</code> package when used in
|
||||
a CGI environment.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.6.3">Go
|
||||
1.6.3 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.6.4 (released 2016/12/01) includes two security fixes.
|
||||
It contains the same fixes as Go 1.7.4 and was released at the same time.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.7.4">Go
|
||||
1.7.4 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<h2 id="go1.5">go1.5 (released 2015/08/19)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.5 is a major release of Go.
|
||||
Read the <a href="/doc/go1.5">Go 1.5 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.5.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.5.1 (released 2015/09/08) includes bug fixes to the compiler, assembler, and
|
||||
the <code>fmt</code>, <code>net/textproto</code>, <code>net/http</code>, and
|
||||
<code>runtime</code> packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.5.1">Go
|
||||
1.5.1 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.5.2 (released 2015/12/02) includes bug fixes to the compiler, linker, and
|
||||
the <code>mime/multipart</code>, <code>net</code>, and <code>runtime</code>
|
||||
packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.5.2">Go
|
||||
1.5.2 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.5.3 (released 2016/01/13) includes a security fix to the <code>math/big</code> package
|
||||
affecting the <code>crypto/tls</code> package.
|
||||
See the <a href="https://golang.org/s/go153announce">release announcement</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.5.4 (released 2016/04/12) includes two security fixes.
|
||||
It contains the same fixes as Go 1.6.1 and was released at the same time.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.6.1">Go
|
||||
1.6.1 milestone</a> on our issue tracker for details.
|
||||
</p>
|
||||
|
||||
<h2 id="go1.4">go1.4 (released 2014/12/10)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.4 is a major release of Go.
|
||||
Read the <a href="/doc/go1.4">Go 1.4 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.4.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.4.1 (released 2015/01/15) includes bug fixes to the linker and the <code>log</code>, <code>syscall</code>, and <code>runtime</code> packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.4.1">Go 1.4.1 milestone on our issue tracker</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.4.2 (released 2015/02/17) includes bug fixes to the <code>go</code> command, the compiler and linker, and the <code>runtime</code>, <code>syscall</code>, <code>reflect</code>, and <code>math/big</code> packages.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.4.2">Go 1.4.2 milestone on our issue tracker</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.4.3 (released 2015/09/22) includes security fixes to the <code>net/http</code> package and bug fixes to the <code>runtime</code> package.
|
||||
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.4.3">Go 1.4.3 milestone on our issue tracker</a> for details.
|
||||
</p>
|
||||
|
||||
<h2 id="go1.3">go1.3 (released 2014/06/18)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.3 is a major release of Go.
|
||||
Read the <a href="/doc/go1.3">Go 1.3 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.3.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.3.1 (released 2014/08/13) includes bug fixes to the compiler and the <code>runtime</code>, <code>net</code>, and <code>crypto/rsa</code> packages.
|
||||
See the <a href="https://github.com/golang/go/commits/go1.3.1">change history</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.3.2 (released 2014/09/25) includes bug fixes to cgo and the crypto/tls packages.
|
||||
See the <a href="https://github.com/golang/go/commits/go1.3.2">change history</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.3.3 (released 2014/09/30) includes further bug fixes to cgo, the runtime package, and the nacl port.
|
||||
See the <a href="https://github.com/golang/go/commits/go1.3.3">change history</a> for details.
|
||||
</p>
|
||||
|
||||
<h2 id="go1.2">go1.2 (released 2013/12/01)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.2 is a major release of Go.
|
||||
Read the <a href="/doc/go1.2">Go 1.2 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.2.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.2.1 (released 2014/03/02) includes bug fixes to the <code>runtime</code>, <code>net</code>, and <code>database/sql</code> packages.
|
||||
See the <a href="https://github.com/golang/go/commits/go1.2.1">change history</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.2.2 (released 2014/05/05) includes a
|
||||
<a href="https://github.com/golang/go/commits/go1.2.2">security fix</a>
|
||||
that affects the tour binary included in the binary distributions (thanks to Guillaume T).
|
||||
</p>
|
||||
|
||||
<h2 id="go1.1">go1.1 (released 2013/05/13)</h2>
|
||||
|
||||
<p>
|
||||
Go 1.1 is a major release of Go.
|
||||
Read the <a href="/doc/go1.1">Go 1.1 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.1.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.1.1 (released 2013/06/13) includes several compiler and runtime bug fixes.
|
||||
See the <a href="https://github.com/golang/go/commits/go1.1.1">change history</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.1.2 (released 2013/08/13) includes fixes to the <code>gc</code> compiler
|
||||
and <code>cgo</code>, and the <code>bufio</code>, <code>runtime</code>,
|
||||
<code>syscall</code>, and <code>time</code> packages.
|
||||
See the <a href="https://github.com/golang/go/commits/go1.1.2">change history</a> for details.
|
||||
If you use package syscall's <code>Getrlimit</code> and <code>Setrlimit</code>
|
||||
functions under Linux on the ARM or 386 architectures, please note change
|
||||
<a href="//golang.org/cl/11803043">11803043</a>
|
||||
that fixes <a href="//golang.org/issue/5949">issue 5949</a>.
|
||||
</p>
|
||||
|
||||
<h2 id="go1">go1 (released 2012/03/28)</h2>
|
||||
|
||||
<p>
|
||||
Go 1 is a major release of Go that will be stable in the long term.
|
||||
Read the <a href="/doc/go1.html">Go 1 Release Notes</a> for more information.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is intended that programs written for Go 1 will continue to compile and run
|
||||
correctly, unchanged, under future versions of Go 1.
|
||||
Read the <a href="/doc/go1compat.html">Go 1 compatibility document</a> for more
|
||||
about the future of Go 1.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The go1 release corresponds to
|
||||
<code><a href="weekly.html#2012-03-27">weekly.2012-03-27</a></code>.
|
||||
</p>
|
||||
|
||||
<h3 id="go1.minor">Minor revisions</h3>
|
||||
|
||||
<p>
|
||||
go1.0.1 (released 2012/04/25) was issued to
|
||||
<a href="//golang.org/cl/6061043">fix</a> an
|
||||
<a href="//golang.org/issue/3545">escape analysis bug</a>
|
||||
that can lead to memory corruption.
|
||||
It also includes several minor code and documentation fixes.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.0.2 (released 2012/06/13) was issued to fix two bugs in the implementation
|
||||
of maps using struct or array keys:
|
||||
<a href="//golang.org/issue/3695">issue 3695</a> and
|
||||
<a href="//golang.org/issue/3573">issue 3573</a>.
|
||||
It also includes many minor code and documentation fixes.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
go1.0.3 (released 2012/09/21) includes minor code and documentation fixes.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
See the <a href="https://github.com/golang/go/commits/release-branch.go1">go1 release branch history</a> for the complete list of changes.
|
||||
</p>
|
||||
|
||||
<h2 id="pre.go1">Older releases</h2>
|
||||
|
||||
<p>
|
||||
See the <a href="pre_go1.html">Pre-Go 1 Release History</a> page for notes
|
||||
on earlier releases.
|
||||
</p>
|
||||
|
||||
|
||||
135
doc/devel/roadmap.html
Normal file
135
doc/devel/roadmap.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<!-- Roadmap -->
|
||||
|
||||
<h2 id="Roadmap">Go Roadmap</h2>
|
||||
|
||||
<p>
|
||||
This page lists features and ideas being developed or discussed by the
|
||||
Go team. This list will be updated as work continues.
|
||||
|
||||
<p>
|
||||
The roadmap should be discussed on
|
||||
the <a href="http://groups.google.com/group/golang-nuts">golang-nuts
|
||||
mailing list</a>.
|
||||
|
||||
<h3 id="Language_roadmap">
|
||||
Language roadmap</h3>
|
||||
|
||||
<p>
|
||||
This is a list of language changes that are being considered.
|
||||
Appearance on this list is no guarantee that the change will be
|
||||
accepted.
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Possibly rewrite restriction on goto across variable declarations.
|
||||
<li>
|
||||
Variant types. A way to define a type as being the union of some set
|
||||
of types.
|
||||
<li>
|
||||
Generics. An active topic of discussion.
|
||||
<li>
|
||||
Methods for operators, to allow a type to use arithmetic notation for
|
||||
expressions.
|
||||
<li>
|
||||
Possibly allow top-level packages to be given names other than main.
|
||||
</ul>
|
||||
|
||||
<h3 id="Implementation_roadmap">
|
||||
Implementation roadmap</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Improved garbage collector.
|
||||
<li>
|
||||
Debugger.
|
||||
<li>
|
||||
App Engine support.
|
||||
<li>
|
||||
Improved implementation documentation.
|
||||
</ul>
|
||||
|
||||
<h4 id="Gc_roadmap">
|
||||
Gc compiler roadmap</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Implement goto restrictions.
|
||||
<li>
|
||||
Improved optimization.
|
||||
<li>
|
||||
Use escape analysis to keep more data on stack.
|
||||
</ul>
|
||||
|
||||
<h4 id="Gccgo_roadmap">
|
||||
Gccgo compiler roadmap</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Implement goto restrictions.
|
||||
<li>
|
||||
Use goroutines rather than threads.
|
||||
<li>
|
||||
Separate gcc interface from frontend proper.
|
||||
<li>
|
||||
Use escape analysis to keep more data on stack.
|
||||
</ul>
|
||||
|
||||
<h4 id="Tools_roadmap">
|
||||
Tools roadmap</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Strengthen goinstall until it can displace make for most builds.
|
||||
</ul>
|
||||
|
||||
<h4 id="Packages_roadmap">
|
||||
Packages roadmap</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Faster, RE2-like regular expressions.
|
||||
<li>
|
||||
Comprehensive support for international text.
|
||||
<li>
|
||||
Support for international dates, times, etc.
|
||||
<li>
|
||||
Support for multilingual messages.
|
||||
</ul>
|
||||
|
||||
|
||||
<h3 id="done">Done</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
gc: Generate DWARF debug info.
|
||||
<li>
|
||||
gc: Provide gdb support for runtime facilities.
|
||||
<li>
|
||||
Safe compilation mode: generate code that is guaranteed not to obtain an invalid memory address other than via <code>import "unsafe"</code>.
|
||||
<li>
|
||||
Gccgo: garbage collection.
|
||||
<li>
|
||||
SWIG support.
|
||||
<li>
|
||||
Simpler semicolon rules.
|
||||
<li>
|
||||
A more general definition of <code>...</code> in parameter lists.
|
||||
<li>
|
||||
Explicit conversions from <code>string</code>
|
||||
to <code>[]byte</code> and <code>[]int</code>.
|
||||
<li>
|
||||
A function that will be run by the garbage collector when an item is freed
|
||||
(runtime.SetFinalizer).
|
||||
<li>
|
||||
Public continuous build and benchmark infrastructure (gobuilder).
|
||||
<li>
|
||||
Package manager (goinstall).
|
||||
<li>
|
||||
A means of recovering from a panic (recover).
|
||||
<li>
|
||||
5g: Better floating point support.
|
||||
<li>
|
||||
Improved CGO including some mechanism for calling back from C to Go.
|
||||
<li>
|
||||
Faster, allocation-light reflection.
|
||||
</ul>
|
||||
File diff suppressed because it is too large
Load Diff
276
doc/docs.html
276
doc/docs.html
@@ -1,205 +1,195 @@
|
||||
<!--{
|
||||
"Title": "Documentation",
|
||||
"Path": "/doc/"
|
||||
}-->
|
||||
|
||||
<p>
|
||||
The Go programming language is an open source project to make programmers more
|
||||
productive.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Go is expressive, concise, clean, and efficient. Its concurrency
|
||||
mechanisms make it easy to write programs that get the most out of multicore
|
||||
and networked machines, while its novel type system enables flexible and
|
||||
modular program construction. Go compiles quickly to machine code yet has the
|
||||
convenience of garbage collection and the power of run-time reflection. It's a
|
||||
fast, statically typed, compiled language that feels like a dynamically typed,
|
||||
interpreted language.
|
||||
</p>
|
||||
|
||||
<div id="manual-nav"></div>
|
||||
|
||||
<h2>Installing Go</h2>
|
||||
|
||||
<h3><a href="/doc/install">Getting Started</a></h3>
|
||||
<p>
|
||||
Instructions for downloading and installing the Go compilers, tools, and
|
||||
libraries.
|
||||
</p>
|
||||
<!-- title Documentation -->
|
||||
|
||||
<div class="left-column">
|
||||
|
||||
<h2 id="learning">Learning Go</h2>
|
||||
|
||||
<img class="gopher" src="/doc/gopher/doc.png"/>
|
||||
|
||||
<h3 id="go_tour"><a href="//tour.golang.org/">A Tour of Go</a></h3>
|
||||
<p>
|
||||
An interactive introduction to Go in three sections.
|
||||
The first section covers basic syntax and data structures; the second discusses
|
||||
methods and interfaces; and the third introduces Go's concurrency primitives.
|
||||
Each section concludes with a few exercises so you can practice what you've
|
||||
learned. You can <a href="//tour.golang.org/">take the tour online</a> or
|
||||
install it locally with:
|
||||
If you're new to Go, we recommend you work through the
|
||||
<a href="go_tutorial.html">tutorial</a>. The
|
||||
<a href="go_spec.html">language specification</a> has all the details should
|
||||
you want to explore.
|
||||
</p>
|
||||
<p>
|
||||
<pre>
|
||||
$ go get golang.org/x/tour/gotour
|
||||
</pre>
|
||||
This will place the <code>gotour</code> binary in your workspace's <code>bin</code> directory.
|
||||
Once you've learned a little about the language,
|
||||
<a href="effective_go.html">Effective Go</a> will help you learn the style and
|
||||
idioms of programming in Go.
|
||||
</p>
|
||||
|
||||
<h3 id="code"><a href="code.html">How to write Go code</a></h3>
|
||||
<h3 id="orig_tutorial"><a href="go_tutorial.html">A Tutorial for the Go Programming Language</a></h3>
|
||||
<p>
|
||||
Also available as a
|
||||
<a href="//www.youtube.com/watch?v=XCsL89YtqCs">screencast</a>, this doc
|
||||
explains how to use the <a href="/cmd/go/">go command</a> to fetch, build, and
|
||||
install packages, commands, and run tests.
|
||||
The first tutorial. An introductory text that touches upon several core
|
||||
concepts: syntax, types, allocation, constants, I/O, sorting, printing,
|
||||
goroutines, and channels.
|
||||
</p>
|
||||
|
||||
<h3 id="effective_go"><a href="effective_go.html">Effective Go</a></h3>
|
||||
<p>
|
||||
A document that gives tips for writing clear, idiomatic Go code.
|
||||
A must read for any new Go programmer. It augments the tour and
|
||||
A must read for any new Go programmer. It augments the tutorial and
|
||||
the language specification, both of which should be read first.
|
||||
</p>
|
||||
|
||||
<h3 id="faq"><a href="/doc/faq">Frequently Asked Questions (FAQ)</a></h3>
|
||||
<h3 id="go_faq"><a href="go_faq.html">Frequently Asked Questions (FAQ)</a></h3>
|
||||
<p>
|
||||
Answers to common questions about Go.
|
||||
</p>
|
||||
|
||||
<h3 id="wiki"><a href="/wiki">The Go Wiki</a></h3>
|
||||
<p>A wiki maintained by the Go community.</p>
|
||||
|
||||
<h4 id="learn_more">More</h4>
|
||||
<h3 id="code"><a href="code.html">How to write Go code</a></h3>
|
||||
<p>
|
||||
See the <a href="/wiki/Learn">Learn</a> page at the <a href="/wiki">Wiki</a>
|
||||
for more Go learning resources.
|
||||
How to write a new package and how to test code.
|
||||
</p>
|
||||
|
||||
<h3 id="codelab_wiki"><a href="codelab/wiki/">Codelab: Writing Web Applications</a></h3>
|
||||
<p>
|
||||
This codelab takes the reader through the creation of a simple wiki web
|
||||
application. It touches on structs, methods, file I/O, http, regular expressions,
|
||||
and closures.
|
||||
</p>
|
||||
|
||||
<h2 id="references">References</h2>
|
||||
<h3 id="codewalks"><a href="codewalk/">Codewalks</a></h3>
|
||||
<p>
|
||||
Guided tours of Go programs.
|
||||
</p>
|
||||
|
||||
<h3 id="go_for_cpp_programmers"><a href="go_for_cpp_programmers.html">Go for C++ Programmers</a></h3>
|
||||
<p>
|
||||
An introduction to Go for C++ programmers.
|
||||
</p>
|
||||
|
||||
<h2 id="tutorials_nonenglish">Non-English Documentation</h2>
|
||||
|
||||
<h3 id="docs_cn">Chinese — 中文</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://code.google.com/p/golang-china/">golang-china</a> - a broad range of Go documentation.</li>
|
||||
<li><a href="http://code.google.com/p/ac-me/downloads/detail?name=fango.pdf">Effective Go and Tutorial</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id="docs_de">German — Deutsch</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://bitloeffel.de/DOC/golang/go_tutorial_de.html">Eine Anleitung zum Programmieren in Go</a> - the Go Tutorial.</li>
|
||||
<li><a href="http://bitloeffel.de/DOC/golang/effective_go_de.html">Wirkungsvoll Go programmieren</a> - Effective Go.</li>
|
||||
<li><a href="http://bitloeffel.de/DOC/golang/code_de.html">Wie man Go-Kode schreibt</a> - How to Write Go Code.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="docs_jp">Japanese — 日本語</h3>
|
||||
<ul>
|
||||
<li><a href="http://golang.jp/">golang.jp</a> - Go documentation and news.
|
||||
</ul>
|
||||
|
||||
<h3 id="docs_ru">Russian — Русский</h3>
|
||||
<ul>
|
||||
<li><a href="http://golanguage.ru/">golanguage.ru</a> - Go documentation.
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="right-column">
|
||||
|
||||
<h2 id="References">References</h2>
|
||||
|
||||
<p>Keep these under your pillow.</p>
|
||||
|
||||
<h3 id="pkg"><a href="/pkg/">Package Documentation</a></h3>
|
||||
<p>
|
||||
The documentation for the Go standard library.
|
||||
The built-in documentation for the Go standard library.
|
||||
</p>
|
||||
|
||||
<h3 id="cmd"><a href="/doc/cmd">Command Documentation</a></h3>
|
||||
<h3 id="cmd"><a href="/cmd/">Command Documentation</a></h3>
|
||||
<p>
|
||||
The documentation for the Go tools.
|
||||
The built-in documentation for the Go tools.
|
||||
</p>
|
||||
|
||||
<h3 id="spec"><a href="/ref/spec">Language Specification</a></h3>
|
||||
<h3 id="spec"><a href="go_spec.html">Language Specification</a></h3>
|
||||
<p>
|
||||
The official Go Language specification.
|
||||
The official Go Language specification.
|
||||
</p>
|
||||
|
||||
<h3 id="go_mem"><a href="/ref/mem">The Go Memory Model</a></h3>
|
||||
<h3 id="go_mem"><a href="go_mem.html">The Go Memory Model</a></h3>
|
||||
<p>
|
||||
A document that specifies the conditions under which reads of a variable in
|
||||
one goroutine can be guaranteed to observe values produced by writes to the
|
||||
same variable in a different goroutine.
|
||||
</p>
|
||||
|
||||
<h3 id="release"><a href="/doc/devel/release.html">Release History</a></h3>
|
||||
<p>A summary of the changes between Go releases.</p>
|
||||
<h2 id="videos_talks">Videos and Talks</h2>
|
||||
|
||||
|
||||
<h2 id="articles">Articles</h2>
|
||||
|
||||
<h3 id="blog"><a href="//blog.golang.org/">The Go Blog</a></h3>
|
||||
<p>The official blog of the Go project, featuring news and in-depth articles by
|
||||
the Go team and guests.</p>
|
||||
|
||||
<h4>Codewalks</h4>
|
||||
<h3 id="go_programming"><a href="http://www.youtube.com/watch?v=jgVhBThJdXc">Go Programming</a></h3>
|
||||
<p>
|
||||
Guided tours of Go programs.
|
||||
A presentation delivered by Rob Pike and Russ Cox at Google I/O 2010. It
|
||||
illustrates how programming in Go differs from other languages through a set of
|
||||
examples demonstrating features particular to Go. These include concurrency,
|
||||
embedded types, methods on any type, and program construction using interfaces.
|
||||
</p>
|
||||
|
||||
<h3 id="practical_go_programming"><a href="http://osdc.blip.tv/file/4432146/">Practical Go Programming</a></h3>
|
||||
<p>
|
||||
This talk presents the development of a complete web application in Go.
|
||||
It looks at design, storage, concurrency, and scaling issues in detail, using
|
||||
the simple example of an URL shortening service.
|
||||
See the <a href="http://wh3rd.net/practical-go/">presentation slides</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="techtalk"><a href="http://www.youtube.com/watch?v=rKnDgT73v8s">The Go Tech Talk</a></h3>
|
||||
<p>
|
||||
An hour-long talk delivered by Rob Pike at Google in October 2009.
|
||||
The language's first public introduction. (See the <a href="talks/go_talk-20091030.pdf">slides in PDF format</a>.) The language has changed since it was made,
|
||||
but it's still a good introduction.
|
||||
</p>
|
||||
|
||||
<h3 id="gocoding_channel"><a href="http://www.youtube.com/gocoding">gocoding YouTube Channel</a></h3>
|
||||
<p>
|
||||
A YouTube channel that includes screencasts and other Go-related videos:
|
||||
</p>
|
||||
<ul>
|
||||
<li><a href="/doc/codewalk/functions">First-Class Functions in Go</a></li>
|
||||
<li><a href="/doc/codewalk/markov">Generating arbitrary text: a Markov chain algorithm</a></li>
|
||||
<li><a href="/doc/codewalk/sharemem">Share Memory by Communicating</a></li>
|
||||
<li><a href="/doc/articles/wiki/">Writing Web Applications</a> - building a simple web application.</li>
|
||||
<li><a href="http://www.youtube.com/gocoding#p/u/0/jDWBJOXs_iI">Screencast: Writing Go Packages</a> - writing, building, and distributing Go packages.</li>
|
||||
<li><a href="http://www.youtube.com/watch?v=3brH0zOqm0w">Screencast: Testing Go Packages</a> - writing unit tests and benchmarking Go packages.</li>
|
||||
</ul>
|
||||
|
||||
<h4>Language</h4>
|
||||
<ul>
|
||||
<li><a href="/blog/json-rpc-tale-of-interfaces">JSON-RPC: a tale of interfaces</a></li>
|
||||
<li><a href="/blog/gos-declaration-syntax">Go's Declaration Syntax</a></li>
|
||||
<li><a href="/blog/defer-panic-and-recover">Defer, Panic, and Recover</a></li>
|
||||
<li><a href="/blog/go-concurrency-patterns-timing-out-and">Go Concurrency Patterns: Timing out, moving on</a></li>
|
||||
<li><a href="/blog/go-slices-usage-and-internals">Go Slices: usage and internals</a></li>
|
||||
<li><a href="/blog/gif-decoder-exercise-in-go-interfaces">A GIF decoder: an exercise in Go interfaces</a></li>
|
||||
<li><a href="/blog/error-handling-and-go">Error Handling and Go</a></li>
|
||||
<li><a href="/blog/organizing-go-code">Organizing Go code</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Packages</h4>
|
||||
<ul>
|
||||
<li><a href="/blog/json-and-go">JSON and Go</a> - using the <a href="/pkg/encoding/json/">json</a> package.</li>
|
||||
<li><a href="/blog/gobs-of-data">Gobs of data</a> - the design and use of the <a href="/pkg/encoding/gob/">gob</a> package.</li>
|
||||
<li><a href="/blog/laws-of-reflection">The Laws of Reflection</a> - the fundamentals of the <a href="/pkg/reflect/">reflect</a> package.</li>
|
||||
<li><a href="/blog/go-image-package">The Go image package</a> - the fundamentals of the <a href="/pkg/image/">image</a> package.</li>
|
||||
<li><a href="/blog/go-imagedraw-package">The Go image/draw package</a> - the fundamentals of the <a href="/pkg/image/draw/">image/draw</a> package.</li>
|
||||
</ul>
|
||||
|
||||
<h4>Tools</h4>
|
||||
<ul>
|
||||
<li><a href="/doc/articles/go_command.html">About the Go command</a> - why we wrote it, what it is, what it's not, and how to use it.</li>
|
||||
<li><a href="/blog/c-go-cgo">C? Go? Cgo!</a> - linking against C code with <a href="/cmd/cgo/">cgo</a>.</li>
|
||||
<li><a href="/doc/gdb">Debugging Go Code with GDB</a></li>
|
||||
<li><a href="/blog/godoc-documenting-go-code">Godoc: documenting Go code</a> - writing good documentation for <a href="/cmd/godoc/">godoc</a>.</li>
|
||||
<li><a href="/blog/profiling-go-programs">Profiling Go Programs</a></li>
|
||||
<li><a href="/doc/articles/race_detector.html">Data Race Detector</a> - a manual for the data race detector.</li>
|
||||
<li><a href="/blog/race-detector">Introducing the Go Race Detector</a> - an introduction to the race detector.</li>
|
||||
<li><a href="/doc/asm">A Quick Guide to Go's Assembler</a> - an introduction to the assembler used by Go.</li>
|
||||
</ul>
|
||||
|
||||
<h4 id="articles_more">More</h4>
|
||||
<h3 id="jaoo_go"><a href="/doc/ExpressivenessOfGo.pdf">The Expressiveness Of Go</a></h3>
|
||||
<p>
|
||||
See the <a href="/wiki/Articles">Articles page</a> at the
|
||||
<a href="/wiki">Wiki</a> for more Go articles.
|
||||
A discussion of the qualities that make Go an expressive and comprehensible
|
||||
language. The talk was presented by Rob Pike at JAOO 2010.
|
||||
The recording of the event was lost due to a hardware error.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="talks">Talks</h2>
|
||||
|
||||
<img class="gopher" src="/doc/gopher/talks.png"/>
|
||||
|
||||
<h3 id="video_tour_of_go"><a href="http://research.swtch.com/gotour">A Video Tour of Go</a></h3>
|
||||
<h3 id="oscon_go"><a href="http://www.oscon.com/oscon2010/public/schedule/detail/14760">Another Go at Language Design</a></h3>
|
||||
<p>
|
||||
Three things that make Go fast, fun, and productive:
|
||||
interfaces, reflection, and concurrency. Builds a toy web crawler to
|
||||
demonstrate these.
|
||||
A tour, with some background, of the major features of Go, intended for
|
||||
an audience new to the language. The talk was presented at OSCON 2010.
|
||||
See the <a href="http://assets.en.oreilly.com/1/event/45/Another%20Go%20at%20Language%20Design%20Presentation.pdf">presentation slides</a>.
|
||||
</p>
|
||||
<p>
|
||||
This talk was also delivered at Sydney University in September 2010. A video
|
||||
of the lecture is available
|
||||
<a href="http://sydney.edu.au/engineering/it/videos/seminar_pike">here</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="go_code_that_grows"><a href="//vimeo.com/53221560">Code that grows with grace</a></h3>
|
||||
<h3 id="emerging_go"><a href="http://www.oscon.com/oscon2010/public/schedule/detail/15464">Go Emerging Languages Conference Talk</a></h3>
|
||||
<p>
|
||||
One of Go's key design goals is code adaptability; that it should be easy to take a simple design and build upon it in a clean and natural way. In this talk Andrew Gerrand describes a simple "chat roulette" server that matches pairs of incoming TCP connections, and then use Go's concurrency mechanisms, interfaces, and standard library to extend it with a web interface and other features. While the function of the program changes dramatically, Go's flexibility preserves the original design as it grows.
|
||||
Rob Pike's Emerging Languages Conference presentation delivered in July 2010. See the <a href="http://assets.en.oreilly.com/1/event/45/Go%20Presentation.pdf">presentation slides</a>. Abstract:
|
||||
</p>
|
||||
<p><i>
|
||||
Go’s approach to concurrency differs from that of many languages, even those
|
||||
(such as Erlang) that make concurrency central, yet it has deep roots. The path
|
||||
from Hoare’s 1978 paper to Go provides insight into how and why Go works as it
|
||||
does.
|
||||
</i></p>
|
||||
|
||||
<h3 id="emerging_go"><a href="talks/gofrontend-gcc-summit-2010.pdf">The Go frontend for GCC</a></h3>
|
||||
<p>
|
||||
A description of the Go language frontend for gcc.
|
||||
Ian Lance Taylor's paper delivered at the GCC Summit 2010.
|
||||
</p>
|
||||
|
||||
<h3 id="go_concurrency_patterns"><a href="//www.youtube.com/watch?v=f6kdp27TYZs">Go Concurrency Patterns</a></h3>
|
||||
<h3 id="promo_video"><a href="http://www.youtube.com/watch?v=wwoWei-GAPo">The Go Promo Video</a></h3>
|
||||
<p>
|
||||
Concurrency is the key to designing high performance network services. Go's concurrency primitives (goroutines and channels) provide a simple and efficient means of expressing concurrent execution. In this talk we see how tricky concurrency problems can be solved gracefully with simple Go code.
|
||||
A short promotional video featuring Russ Cox demonstrating Go's fast compiler.
|
||||
</p>
|
||||
|
||||
<h3 id="advanced_go_concurrency_patterns"><a href="//www.youtube.com/watch?v=QDDwwePbDtw">Advanced Go Concurrency Patterns</a></h3>
|
||||
<p>
|
||||
This talk expands on the <i>Go Concurrency Patterns</i> talk to dive deeper into Go's concurrency primitives.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h4 id="talks_more">More</h4>
|
||||
<p>
|
||||
See the <a href="/talks">Go Talks site</a> and <a href="/wiki/GoTalks">wiki page</a> for more Go talks.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="nonenglish">Non-English Documentation</h2>
|
||||
|
||||
<p>
|
||||
See the <a href="/wiki/NonEnglish">NonEnglish</a> page
|
||||
at the <a href="/wiki">Wiki</a> for localized
|
||||
documentation.
|
||||
</p>
|
||||
<div class="end-columns"></div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
140
doc/frontpage.css
Normal file
140
doc/frontpage.css
Normal file
@@ -0,0 +1,140 @@
|
||||
/* Overloads to all.css */
|
||||
#container { width: 76em }
|
||||
.left-column { width: 48%; }
|
||||
.right-column { width: 48%; }
|
||||
|
||||
/* Frontpage styles */
|
||||
#content-introductory code {
|
||||
font-family: "Bitstream Vera Sans Mono", "Andale Mono", monospace;
|
||||
}
|
||||
#content-introductory input, select, textarea {
|
||||
font-family: "Bitstream Vera Sans", Verdana, sans-serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
span.keyword {
|
||||
font-family: Cambria, Georgia, Times, "Times New Roman", serif;
|
||||
font-size: 1.15em;
|
||||
font-style: italic;
|
||||
}
|
||||
#content h3, #content h2 {
|
||||
margin: 0;
|
||||
font-size: 1em;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
#content .more {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
}
|
||||
#frontpage h2#branding-tagline {
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
#resources {
|
||||
position: relative;
|
||||
margin-top: 1em;
|
||||
}
|
||||
#resources h3 {
|
||||
margin-top: 0;
|
||||
margin-bottom: -.5em;
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
}
|
||||
#resources-users {
|
||||
float: left;
|
||||
width: 48%;
|
||||
}
|
||||
#resources-contributors {
|
||||
float: right;
|
||||
width: 50%;
|
||||
}
|
||||
#resources ul {
|
||||
padding-left: 2em;
|
||||
}
|
||||
#resources li {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
#content-rotating {
|
||||
height: 200px;
|
||||
}
|
||||
#content-videos {
|
||||
float: left;
|
||||
width: 170px;
|
||||
}
|
||||
#content-videos .thumbnail {
|
||||
width: 150px;
|
||||
height: 103px;
|
||||
background-repeat: no-repeat;
|
||||
border: none;
|
||||
}
|
||||
#content-videos .thumbnail._001 {
|
||||
background: url(/doc/video-001.png);
|
||||
}
|
||||
#content-videos .thumbnail._002 {
|
||||
background: url(/doc/video-002.png);
|
||||
}
|
||||
#content-videos .thumbnail._003 {
|
||||
background: url(/doc/video-003.png);
|
||||
}
|
||||
#content-videos .thumbnail._004 {
|
||||
background: url(/doc/video-004.png);
|
||||
}
|
||||
#content-videos a.video {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
margin-right: .30em;
|
||||
margin-top: 1.2em;
|
||||
}
|
||||
#content-videos a.video .caption {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
#content-videos a.video .caption.title {
|
||||
margin-top: .31em;
|
||||
font-weight: bold;
|
||||
}
|
||||
#content-blog ul {
|
||||
margin-top: 1em;
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
#content-blog li {
|
||||
list-style: none;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#content-blog li a {
|
||||
color: #999;
|
||||
text-decoration: none;
|
||||
}
|
||||
#content-blog .date {
|
||||
color: #999;
|
||||
font-size: 0.8em;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
#content-blog li a:link .title {
|
||||
color: #04a;
|
||||
}
|
||||
#content-blog li a:visited .title {
|
||||
color: #04a;
|
||||
}
|
||||
#content-blog li a:hover .title {
|
||||
color: #a40;
|
||||
text-decoration: underline;
|
||||
}
|
||||
#content-blog li a:active .title {
|
||||
color: #c00;
|
||||
}
|
||||
.navtop {
|
||||
display: none !important;
|
||||
}
|
||||
.how {
|
||||
float: right;
|
||||
font-size: 75%;
|
||||
}
|
||||
.unsupported {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
}
|
||||
|
||||
@@ -1,112 +1,99 @@
|
||||
<!--{
|
||||
"Title": "Contributing to the gccgo frontend"
|
||||
}-->
|
||||
<!-- Contributing to the gccgo frontend -->
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
<p>
|
||||
These are some notes on contributing to the gccgo frontend for GCC.
|
||||
For information on contributing to parts of Go other than gccgo,
|
||||
see <a href="/doc/contribute.html">Contributing to the Go project</a>. For
|
||||
information on building gccgo for yourself,
|
||||
see <a href="/doc/gccgo_install.html">Setting up and using gccgo</a>.
|
||||
For more of the gritty details on the process of doing development
|
||||
with the gccgo frontend,
|
||||
see <a href="https://go.googlesource.com/gofrontend/+/master/HACKING">the
|
||||
file HACKING</a> in the gofrontend repository.
|
||||
These are some notes on contributing to the <code>gccgo</code>
|
||||
frontend for GCC. For information on contributing to parts of Go other
|
||||
than <code>gccgo</code>, see <a href="contribute.html">Contributing to
|
||||
the Go project</a>. For information on building <code>gccgo</code>
|
||||
for yourself, see <a href="gccgo_install.html">Setting up and using
|
||||
gccgo</a>.
|
||||
</p>
|
||||
|
||||
<h2>Legal Prerequisites</h2>
|
||||
|
||||
<p>
|
||||
You must follow the <a href="/doc/contribute.html#copyright">Go copyright
|
||||
rules</a> for all changes to the gccgo frontend and the associated
|
||||
libgo library. Code that is part of GCC rather than gccgo must follow
|
||||
the general <a href="http://gcc.gnu.org/contribute.html">GCC
|
||||
contribution rules</a>.
|
||||
You must follow the <a href="contribute.html#copyright">Go copyright
|
||||
rules.</a>
|
||||
</p>
|
||||
|
||||
<h2>Code</h2>
|
||||
|
||||
<p>
|
||||
The master sources for the gccgo frontend may be found at
|
||||
<a href="http://go.googlesource.com/gofrontend">http://go.googlesource.com/gofrontend</a>.
|
||||
They are mirrored
|
||||
at <a href="http://github.com/golang/gofrontend">http://github.com/golang/gofrontend</a>.
|
||||
The master sources are not buildable by themselves, but only in
|
||||
conjunction with GCC (in the future, other compilers may be
|
||||
supported). Changes made to the gccgo frontend are also applied to
|
||||
the GCC source code repository hosted at <code>gcc.gnu.org</code>. In
|
||||
the <code>gofrontend</code> repository, the <code>go</code> directory
|
||||
is mirrored to the <code>gcc/go/gofrontend</code> directory in the GCC
|
||||
repository, and the <code>gofrontend</code> <code>libgo</code>
|
||||
directory is mirrored to the GCC <code>libgo</code> directory. In
|
||||
addition, the <code>test</code> directory
|
||||
from <a href="//go.googlesource.com/go">the main Go repository</a>
|
||||
is mirrored to the <code>gcc/testsuite/go.test/test</code> directory
|
||||
in the GCC repository.
|
||||
The source code for the <code>gccgo</code> frontend may be found at
|
||||
<a href="http://code.google.com/p/gofrontend">http://code.google.com/p/gofrontend</a>.
|
||||
Changes made to that project are routinely merged into the source code
|
||||
hosted at <code>gcc.gnu.org</code>. The <code>gofrontend</code>
|
||||
project includes only the Go frontend proper. These are the files
|
||||
which in the <code>gcc</code> sources may be found in the
|
||||
directories <code>gcc/go</code> and <code>libgo</code>.
|
||||
The <code>gcc</code> sources also include a copy of
|
||||
the <code>test</code> directory
|
||||
from <a href="http://code.google.com/p/go">the main Go repository</a>.
|
||||
|
||||
<p>
|
||||
The frontend is written in C++ and as such the GNU coding standards do
|
||||
not entirely apply; in writing code for the frontend, follow the
|
||||
formatting of the surrounding code. Although the frontend is
|
||||
currently closely tied to the rest of the <code>gcc</code> codebase,
|
||||
we plan to make it more independent. Any new code that uses other
|
||||
parts of <code>gcc</code> should be placed in an appropriate file,
|
||||
such as <code>gogo-tree.cc</code>. Eventually
|
||||
all <code>gcc</code>-specific code should migrate to
|
||||
a <code>gcc-interface</code> subdirectory.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Changes to these directories always flow from the master sources to
|
||||
the GCC repository. The files should never be changed in the GCC
|
||||
repository except by changing them in the master sources and mirroring
|
||||
them.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The gccgo frontend is written in C++.
|
||||
It follows the GNU and GCC coding standards for C++.
|
||||
In writing code for the frontend, follow the formatting of the
|
||||
surrounding code.
|
||||
Almost all GCC-specific code is not in the frontend proper and is
|
||||
instead in the GCC sources in the <code>gcc/go</code> directory.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The run-time library for gccgo is mostly the same as the library
|
||||
in <a href="//go.googlesource.com/go">the main Go repository</a>.
|
||||
The library code in the Go repository is periodically merged into
|
||||
the <code>libgo/go</code> directory of the <code>gofrontend</code> and
|
||||
then the GCC repositories, using the shell
|
||||
script <code>libgo/merge.sh</code>. Accordingly, most library changes
|
||||
should be made in the main Go repository. The files outside
|
||||
of <code>libgo/go</code> are gccgo-specific; that said, some of the
|
||||
files in <code>libgo/runtime</code> are based on files
|
||||
in <code>src/runtime</code> in the main Go repository.
|
||||
The run-time library for <code>gccgo</code> is mostly the same as the
|
||||
library in <a href="http://code.google.com/p/go">the main Go
|
||||
repository</a>. The library code in the Go repository is periodically
|
||||
copied into the <code>gofrontend</code> and the <code>gcc</code>
|
||||
repositories. Accordingly, most library changes should be made in the
|
||||
main Go repository. Changes to the few <code>gccgo</code>-specific
|
||||
parts of the library should follow the process described here.
|
||||
The <code>gccgo</code>-specific parts of the library are everything in
|
||||
the <code>libgo</code> directory except for the <code>libgo/go</code>
|
||||
subdirectory.
|
||||
</p>
|
||||
|
||||
<h2>Testing</h2>
|
||||
|
||||
<p>
|
||||
All patches must be tested. A patch that introduces new failures is
|
||||
not acceptable.
|
||||
All patches must be tested. There are two test suites. A patch that
|
||||
introduces new failures is not acceptable.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To run the gccgo test suite, run <code>make check-go</code> in your
|
||||
build directory. This will run various tests
|
||||
under <code>gcc/testsuite/go.*</code> and will also run
|
||||
the <code>libgo</code> testsuite. This copy of the tests from the
|
||||
main Go repository is run using the DejaGNU script found
|
||||
in <code>gcc/testsuite/go.test/go-test.exp</code>.
|
||||
To run the compiler test suite, run <code>make check-go</code> in the
|
||||
<code>gcc</code> subdirectory of your build directory. This will run
|
||||
various tests underneath <code>gcc/testsuite/go.*</code>. This
|
||||
includes a copy of the tests in the main Go repository, which are run
|
||||
using the DejaGNU script found in
|
||||
in <code>gcc/testsuite/go.test/go-test.exp</code>. Many of the
|
||||
compiler tests may be run without the Go library, but some do require
|
||||
the library to built first.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Most new tests should be submitted to the main Go repository for later
|
||||
mirroring into the GCC repository. If there is a need for specific
|
||||
tests for gccgo, they should go in
|
||||
To run the library test suite, run <code>make
|
||||
check-target-libgo</code> in the top level of your build directory.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Most new tests should be submitted to the main Go repository for
|
||||
copying into the <code>gccgo</code> repository. If there is a need
|
||||
for specific tests for <code>gccgo</code>, they should go in
|
||||
the <code>gcc/testsuite/go.go-torture</code>
|
||||
or <code>gcc/testsuite/go.dg</code> directories in the GCC repository.
|
||||
or <code>gcc/testsuite/go.dg</code> directories in
|
||||
the <code>gcc.gnu.org</code> repository.
|
||||
</p>
|
||||
|
||||
<h2>Submitting Changes</h2>
|
||||
|
||||
<p>
|
||||
Changes to the Go frontend should follow the same process as for the
|
||||
main Go repository, only for the <code>gofrontend</code> project and
|
||||
the <code>gofrontend-dev@googlegroups.com</code> mailing list
|
||||
rather than the <code>go</code> project and the
|
||||
<code>golang-dev@googlegroups.com</code> mailing list. Those changes
|
||||
will then be merged into the GCC sources.
|
||||
main Go repository, only for the <code>gofrontend</code> project
|
||||
rather than the <code>go</code> project. Those changes will then be
|
||||
merged into the <code>gcc</code> sources.
|
||||
</p>
|
||||
|
||||
@@ -1,90 +1,37 @@
|
||||
<!--{
|
||||
"Title": "Setting up and using gccgo",
|
||||
"Path": "/doc/install/gccgo"
|
||||
}-->
|
||||
<!-- Setting up and using gccgo -->
|
||||
|
||||
<p>
|
||||
This document explains how to use gccgo, a compiler for
|
||||
the Go language. The gccgo compiler is a new frontend
|
||||
for GCC, the widely used GNU compiler. Although the
|
||||
frontend itself is under a BSD-style license, gccgo is
|
||||
normally used as part of GCC and is then covered by
|
||||
This document explains how to use <code>gccgo</code>, a compiler for
|
||||
the Go language. The <code>gccgo</code> compiler is a new frontend
|
||||
for <code>gcc</code>, the widely used GNU compiler. Although the
|
||||
frontend itself is under a BSD-style license, <code>gccgo</code> is
|
||||
normally used as part of <code>gcc</code> and is then covered by
|
||||
the <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public
|
||||
License</a> (the license covers gccgo itself as part of GCC; it
|
||||
does not cover code generated by gccgo).
|
||||
License</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that gccgo is not the <code>gc</code> compiler; see
|
||||
the <a href="/doc/install.html">Installing Go</a> instructions for that
|
||||
Note that <code>gccgo</code> is not the <code>6g</code> compiler; see
|
||||
the <a href="install.html">Installing Go</a> instructions for that
|
||||
compiler.
|
||||
</p>
|
||||
|
||||
<h2 id="Releases">Releases</h2>
|
||||
|
||||
<p>
|
||||
The simplest way to install gccgo is to install a GCC binary release
|
||||
built to include Go support. GCC binary releases are available from
|
||||
<a href="http://gcc.gnu.org/install/binaries.html">various
|
||||
websites</a> and are typically included as part of GNU/Linux
|
||||
distributions. We expect that most people who build these binaries
|
||||
will include Go support.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The GCC 4.7.1 release and all later 4.7 releases include a complete
|
||||
<a href="/doc/go1.html">Go 1</a> compiler and libraries.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Due to timing, the GCC 4.8.0 and 4.8.1 releases are close to but not
|
||||
identical to Go 1.1. The GCC 4.8.2 release includes a complete Go
|
||||
1.1.2 implementation.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The GCC 4.9 releases include a complete Go 1.2 implementation.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The GCC 5 releases include a complete implementation of the Go 1.4
|
||||
user libraries. The Go 1.4 runtime is not fully merged, but that
|
||||
should not be visible to Go programs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The GCC 6 releases include a complete implementation of the Go 1.6.1
|
||||
user libraries. The Go 1.6 runtime is not fully merged, but that
|
||||
should not be visible to Go programs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The GCC 7 releases are expected to include a complete implementation
|
||||
of the Go 1.8 user libraries. As with earlier releases, the Go 1.8
|
||||
runtime is not fully merged, but that should not be visible to Go
|
||||
programs.
|
||||
</p>
|
||||
|
||||
<h2 id="Source_code">Source code</h2>
|
||||
|
||||
<p>
|
||||
If you cannot use a release, or prefer to build gccgo for
|
||||
yourself,
|
||||
the gccgo source code is accessible via Subversion. The
|
||||
GCC web site
|
||||
The <code>gccgo</code> source code is accessible via Subversion. The
|
||||
<code>gcc</code> web site
|
||||
has <a href="http://gcc.gnu.org/svn.html">instructions for getting the
|
||||
GCC source code</a>. The gccgo source code is included. As a
|
||||
convenience, a stable version of the Go support is available in
|
||||
a branch of the main GCC code
|
||||
<code>gcc</code> source code</a>. The <code>gccgo</code> source code
|
||||
is a branch of the main <code>gcc</code> code
|
||||
repository: <code>svn://gcc.gnu.org/svn/gcc/branches/gccgo</code>.
|
||||
This branch is periodically updated with stable Go compiler sources.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that although <code>gcc.gnu.org</code> is the most convenient way
|
||||
to get the source code for the Go frontend, it is not where the master
|
||||
sources live. If you want to contribute changes to the Go frontend
|
||||
compiler, see <a href="/doc/gccgo_contribute.html">Contributing to
|
||||
to get the source code for the compiler, that is not where the master
|
||||
sources live. If you want to contribute changes to the gccgo
|
||||
compiler, see <a href="gccgo_contribute.html">Contributing to
|
||||
gccgo</a>.
|
||||
</p>
|
||||
|
||||
@@ -92,37 +39,29 @@ gccgo</a>.
|
||||
<h2 id="Building">Building</h2>
|
||||
|
||||
<p>
|
||||
Building gccgo is just like building GCC
|
||||
Building <code>gccgo</code> is just like building <code>gcc</code>
|
||||
with one or two additional options. See
|
||||
the <a href="http://gcc.gnu.org/install/">instructions on the gcc web
|
||||
site</a>. When you run <code>configure</code>, add the
|
||||
option <code>--enable-languages=c,c++,go</code> (along with other
|
||||
languages you may want to build). If you are targeting a 32-bit x86,
|
||||
then you will want to build gccgo to default to
|
||||
then you will want to build <code>gccgo</code> to default to
|
||||
supporting locked compare and exchange instructions; do this by also
|
||||
using the <code>configure</code> option <code>--with-arch=i586</code>
|
||||
(or a newer architecture, depending on where you need your programs to
|
||||
run). If you are targeting a 64-bit x86, but sometimes want to use
|
||||
the <code>-m32</code> option, then use the <code>configure</code>
|
||||
option <code>--with-arch-32=i586</code>.
|
||||
run).
|
||||
</p>
|
||||
|
||||
<h3 id="Gold">Gold</h3>
|
||||
|
||||
<p>
|
||||
On x86 GNU/Linux systems the gccgo compiler is able to
|
||||
On x86 GNU/Linux systems the <code>gccgo</code> compiler is able to
|
||||
use a small discontiguous stack for goroutines. This permits programs
|
||||
to run many more goroutines, since each goroutine can use a relatively
|
||||
small stack. Doing this requires using the gold linker version 2.22
|
||||
or later. You can either install GNU binutils 2.22 or later, or you
|
||||
can build gold yourself.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To build gold yourself, build the GNU binutils,
|
||||
using <code>--enable-gold=default</code> when you run
|
||||
the <code>configure</code> script. Before building, you must install
|
||||
the flex and bison packages. A typical sequence would look like
|
||||
small stack. Doing this requires using a development version of
|
||||
the <code>gold</code> linker. The easiest way to do this is to build
|
||||
the GNU binutils, using <code>--enable-gold</code> when you run
|
||||
the <code>configure</code> script, and to
|
||||
use <code>--with-ld=GOLD_BINARY</code> when you
|
||||
configure <code>gccgo</code>. A typical sequence would look like
|
||||
this (you can replace <code>/opt/gold</code> with any directory to
|
||||
which you have write access):
|
||||
</p>
|
||||
@@ -130,45 +69,27 @@ which you have write access):
|
||||
<pre>
|
||||
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src login
|
||||
[password is "anoncvs"]
|
||||
[The next command will create a directory named src, not binutils]
|
||||
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co binutils
|
||||
mkdir binutils-objdir
|
||||
cd binutils-objdir
|
||||
../src/configure --enable-gold=default --prefix=/opt/gold
|
||||
../src/configure --enable-gold --prefix=/opt/gold
|
||||
make
|
||||
make install
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
However you install gold, when you configure gccgo, use the
|
||||
option <code>--with-ld=<var>GOLD_BINARY</var></code>.
|
||||
</p>
|
||||
|
||||
<h3 id="Prerequisites">Prerequisites</h3>
|
||||
|
||||
<p>
|
||||
A number of prerequisites are required to build GCC, as
|
||||
described on
|
||||
the <a href="http://gcc.gnu.org/install/prerequisites.html">gcc web
|
||||
site</a>. It is important to install all the prerequisites before
|
||||
running the gcc <code>configure</code> script.
|
||||
The prerequisite libraries can be conveniently downloaded using the
|
||||
script <code>contrib/download_prerequisites</code> in the GCC sources.
|
||||
|
||||
<h3 id="Build_commands">Build commands</h3>
|
||||
|
||||
<p>
|
||||
Once all the prerequisites are installed, then a typical build and
|
||||
install sequence would look like this (only use
|
||||
the <code>--with-ld</code> option if you are using the gold linker as
|
||||
described above):
|
||||
A number of prerequisites are required to build <code>gcc</code>, as
|
||||
described on the <a href="http://gcc.gnu.org/">gcc web site</a>. If
|
||||
those are all available, then a typical build and install sequence
|
||||
would look like this (only use the <code>--with-ld</code> option if
|
||||
you built and installed the gold linker as described above):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
svn checkout svn://gcc.gnu.org/svn/gcc/branches/gccgo gccgo
|
||||
mkdir objdir
|
||||
cd objdir
|
||||
../gccgo/configure --prefix=/opt/gccgo --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld
|
||||
../gccgo/configure --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld
|
||||
make
|
||||
make install
|
||||
</pre>
|
||||
@@ -176,15 +97,10 @@ make install
|
||||
<h2 id="Using_gccgo">Using gccgo</h2>
|
||||
|
||||
<p>
|
||||
The gccgo compiler works like other gcc frontends. As of GCC 5 the gccgo
|
||||
installation also includes a version of the <code>go</code> command,
|
||||
which may be used to build Go programs as described at
|
||||
<a href="https://golang.org/cmd/go">https://golang.org/cmd/go</a>.
|
||||
</p>
|
||||
The <code>gccgo</code> compiler works like other gcc frontends.
|
||||
|
||||
<p>
|
||||
To compile a file without using the <code>go</code> command:
|
||||
</p>
|
||||
To compile a file:
|
||||
|
||||
<pre>
|
||||
gccgo -c file.go
|
||||
@@ -193,7 +109,6 @@ gccgo -c file.go
|
||||
<p>
|
||||
That produces <code>file.o</code>. To link files together to form an
|
||||
executable:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
gccgo -o file file.o
|
||||
@@ -201,135 +116,103 @@ gccgo -o file file.o
|
||||
|
||||
<p>
|
||||
To run the resulting file, you will need to tell the program where to
|
||||
find the compiled Go packages. There are a few ways to do this:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>
|
||||
Set the <code>LD_LIBRARY_PATH</code> environment variable:
|
||||
</p>
|
||||
find the compiled Go packages. This can be done either by setting
|
||||
<code>LD_LIBRARY_PATH</code> in your environment:
|
||||
|
||||
<pre>
|
||||
LD_LIBRARY_PATH=${prefix}/lib/gcc/MACHINE/VERSION
|
||||
[or]
|
||||
LD_LIBRARY_PATH=${prefix}/lib64/gcc/MACHINE/VERSION
|
||||
export LD_LIBRARY_PATH
|
||||
LD_LIBRARY_PATH=/usr/lib/gcc/MACHINE/VERSION
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Here <code>${prefix}</code> is the <code>--prefix</code> option used
|
||||
when building gccgo. For a binary install this is
|
||||
normally <code>/usr</code>. Whether to use <code>lib</code>
|
||||
or <code>lib64</code> depends on the target.
|
||||
Typically <code>lib64</code> is correct for x86_64 systems,
|
||||
and <code>lib</code> is correct for other systems. The idea is to
|
||||
name the directory where <code>libgo.so</code> is found.
|
||||
</p>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
Passing a <code>-Wl,-R</code> option when you link (replace lib with
|
||||
lib64 if appropriate for your system):
|
||||
</p>
|
||||
or by passing a <code>-Wl,-R</code> option when you link:
|
||||
|
||||
<pre>
|
||||
go build -gccgoflags -Wl,-R,${prefix}/lib/gcc/MACHINE/VERSION
|
||||
[or]
|
||||
gccgo -o file file.o -Wl,-R,${prefix}/lib/gcc/MACHINE/VERSION
|
||||
gccgo -o file file.o -Wl,-R,/usr/lib/gcc/MACHINE/VERSION
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
Use the <code>-static-libgo</code> option to link statically against
|
||||
the compiled packages.
|
||||
</p>
|
||||
</li>
|
||||
or you can use the <code>-static-libgo</code> link-time option to link
|
||||
statically against libgo, or you can do a fully static link (static
|
||||
linking is the default for the <code>6l</code> Go linker). On most
|
||||
systems, a static link will look something like:
|
||||
|
||||
<pre>
|
||||
gccgo -o file file.o -static -L /usr/lib/nptl -lgobegin -lgo -lpthread
|
||||
</pre>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
Use the <code>-static</code> option to do a fully static link (the
|
||||
default for the <code>gc</code> compiler).
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
You may get a warning about not creating an <code>.eh_frame_hdr</code>
|
||||
section; this has nothing to do with Go, and may be ignored. In the
|
||||
future the requirement of explicitly specifying
|
||||
<code>-L /usr/lib/nptl -lgobegin -lgo -lpthread</code>
|
||||
may be removed.
|
||||
|
||||
|
||||
<h2 id="Options">Options</h2>
|
||||
|
||||
<p>
|
||||
The gccgo compiler supports all GCC options
|
||||
The <code>gccgo</code> compiler supports all <code>gcc</code> options
|
||||
that are language independent, notably the <code>-O</code>
|
||||
and <code>-g</code> options.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>-fgo-pkgpath=PKGPATH</code> option may be used to set a
|
||||
unique prefix for the package being compiled.
|
||||
This option is automatically used by the go command, but you may want
|
||||
to use it if you invoke gccgo directly.
|
||||
This option is intended for use with large
|
||||
programs that contain many packages, in order to allow multiple
|
||||
packages to use the same identifier as the package name.
|
||||
The <code>PKGPATH</code> may be any string; a good choice for the
|
||||
string is the path used to import the package.
|
||||
</p>
|
||||
The <code>-fgo-prefix=PREFIX</code> option may be used to set a unique
|
||||
prefix for the package being compiled. This option is intended for
|
||||
use with large programs that contain many packages, in order to allow
|
||||
multiple packages to use the same identifier as the package name.
|
||||
The <code>PREFIX</code> may be any string; a good choice for the
|
||||
string is the directory where the package will be installed.
|
||||
|
||||
<p>
|
||||
The <code>-fno-require-return-statement</code> option may be used to
|
||||
disable the compiler error about functions missing return statements.
|
||||
Note that there is no way to disable this error in <code>6g</code>.
|
||||
|
||||
<p>
|
||||
The <code>-I</code> and <code>-L</code> options, which are synonyms
|
||||
for the compiler, may be used to set the search path for finding
|
||||
imports.
|
||||
These options are not needed if you build with the go command.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="Imports">Imports</h2>
|
||||
|
||||
<p>
|
||||
When you compile a file that exports something, the export
|
||||
information will be stored directly in the object file.
|
||||
If you build with gccgo directly, rather than with the go command,
|
||||
then when you import a package, you must tell gccgo how to find the
|
||||
file.
|
||||
</p>
|
||||
When you compile a file which exports something, the export
|
||||
information will be stored directly in the object file. When
|
||||
you import a package, you must tell <code>gccgo</code> how to
|
||||
find the file.
|
||||
|
||||
<p>
|
||||
When you import the package <var>FILE</var> with gccgo,
|
||||
When you import the package <var>FILE</var> with <code>gccgo</code>,
|
||||
it will look for the import data in the following files, and use the
|
||||
first one that it finds.
|
||||
|
||||
<ul>
|
||||
<li><code><var>FILE</var>.gox</code>
|
||||
<li><code><var>FILE</var>.o</code>
|
||||
<li><code>lib<var>FILE</var>.so</code>
|
||||
<li><code>lib<var>FILE</var>.a</code>
|
||||
<li><code><var>FILE</var>.o</code>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<code><var>FILE</var>.gox</code>, when used, will typically contain
|
||||
nothing but export data. This can be generated from
|
||||
<code><var>FILE</var>.o</code> via
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
objcopy -j .go_export FILE.o FILE.gox
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The gccgo compiler will look in the current
|
||||
directory for import files. In more complex scenarios you
|
||||
The <code>gccgo</code> compiler will look in the current
|
||||
directory for import files. In more complex scenarios you
|
||||
may pass the <code>-I</code> or <code>-L</code> option to
|
||||
gccgo. Both options take directories to search. The
|
||||
<code>gccgo</code>. Both options take directories to search. The
|
||||
<code>-L</code> option is also passed to the linker.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The gccgo compiler does not currently (2015-06-15) record
|
||||
The <code>gccgo</code> compiler does not currently (2009-11-06) record
|
||||
the file name of imported packages in the object file. You must
|
||||
arrange for the imported data to be linked into the program.
|
||||
Again, this is not necessary when building with the go command.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
gccgo -c mypackage.go # Exports mypackage
|
||||
@@ -337,49 +220,53 @@ gccgo -c main.go # Imports mypackage
|
||||
gccgo -o main main.o mypackage.o # Explicitly links with mypackage.o
|
||||
</pre>
|
||||
|
||||
<h2 id="Unimplemented">Unimplemented</h2>
|
||||
|
||||
<p>
|
||||
Some Go features are not yet implemented in <code>gccgo</code>. As of
|
||||
2010-08-23, the following are not implemented:
|
||||
|
||||
<ul>
|
||||
<li>goroutines are implemented as NPTL threads. If you can not use
|
||||
the gold linker as described above, they are created with a fixed
|
||||
stack size, and the number of goroutines that may be created at
|
||||
one time is limited.
|
||||
</ul>
|
||||
|
||||
<h2 id="Debugging">Debugging</h2>
|
||||
|
||||
<p>
|
||||
If you use the <code>-g</code> option when you compile, you can run
|
||||
<code>gdb</code> on your executable. The debugger has only limited
|
||||
knowledge about Go. You can set breakpoints, single-step,
|
||||
<code>gdb</code> on your executable. The debugger doesn't (yet)
|
||||
know anything about Go. However, you can set breakpoints, single-step,
|
||||
etc. You can print variables, but they will be printed as though they
|
||||
had C/C++ types. For numeric types this doesn't matter. Go strings
|
||||
and interfaces will show up as two-element structures. Go
|
||||
maps and channels are always represented as C pointers to run-time
|
||||
structures.
|
||||
</p>
|
||||
had C/C++ types. For numeric types this doesn't matter. Go strings
|
||||
will show up as pointers to structures; to see the value
|
||||
<code>print *stringvar</code>. In general Go strings, maps, channels
|
||||
and interfaces are always represented as C pointers.
|
||||
|
||||
<h2 id="C_Interoperability">C Interoperability</h2>
|
||||
|
||||
<p>
|
||||
When using gccgo there is limited interoperability with C,
|
||||
When using <code>gccgo</code> there is limited interoperability with C,
|
||||
or with C++ code compiled using <code>extern "C"</code>.
|
||||
</p>
|
||||
|
||||
<h3 id="Types">Types</h3>
|
||||
|
||||
<p>
|
||||
Basic types map directly: an <code>int32</code> in Go is
|
||||
an <code>int32_t</code> in C, an <code>int64</code> is
|
||||
an <code>int64_t</code>, etc.
|
||||
The Go type <code>int</code> is an integer that is the same size as a
|
||||
pointer, and as such corresponds to the C type <code>intptr_t</code>.
|
||||
Go <code>byte</code> is equivalent to C <code>unsigned char</code>.
|
||||
Pointers in Go are pointers in C.
|
||||
A Go <code>struct</code> is the same as C <code>struct</code> with the
|
||||
same fields and types.
|
||||
</p>
|
||||
Basic types map directly: an <code>int</code> in Go is an <code>int</code>
|
||||
in C, etc. Go <code>byte</code> is equivalent to C <code>unsigned char</code>.
|
||||
Pointers in Go are pointers in C. A Go <code>struct</code> is the same as C
|
||||
<code>struct</code> with the same fields and types.
|
||||
|
||||
<p>
|
||||
The Go <code>string</code> type is currently defined as a two-element
|
||||
structure (this is <b style="color: red;">subject to change</b>):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
struct __go_string {
|
||||
const unsigned char *__data;
|
||||
intptr_t __length;
|
||||
int __length;
|
||||
};
|
||||
</pre>
|
||||
|
||||
@@ -389,39 +276,34 @@ array in Go is equivalent to a C pointer to the
|
||||
equivalent of the element type.
|
||||
For example, Go <code>*[10]int</code> is equivalent to C <code>int*</code>,
|
||||
assuming that the C pointer does point to 10 elements.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A slice in Go is a structure. The current definition is
|
||||
(this is <b style="color: red;">subject to change</b>):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
struct __go_slice {
|
||||
void *__values;
|
||||
intptr_t __count;
|
||||
intptr_t __capacity;
|
||||
int __count;
|
||||
int __capacity;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The type of a Go function is a pointer to a struct (this is
|
||||
<b style="color: red;">subject to change</b>). The first field in the
|
||||
struct points to the code of the function, which will be equivalent to
|
||||
a pointer to a C function whose parameter types are equivalent, with
|
||||
an additional trailing parameter. The trailing parameter is the
|
||||
closure, and the argument to pass is a pointer to the Go function
|
||||
struct.
|
||||
|
||||
When a Go function returns more than one value, the C function returns
|
||||
a struct. For example, these functions are roughly equivalent:
|
||||
</p>
|
||||
The type of a Go function with no receiver is equivalent to a C function
|
||||
whose parameter types are equivalent. When a Go function returns more
|
||||
than one value, the C function returns a struct. For example, these
|
||||
functions have equivalent types:
|
||||
|
||||
<pre>
|
||||
func GoFunction(int) (int, float64)
|
||||
struct { int i; float64 f; } CFunction(int, void*)
|
||||
struct { int i; float64 f; } CFunction(int)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
A pointer to a Go function is equivalent to a pointer to a C function
|
||||
when the functions have equivalent types.
|
||||
|
||||
<p>
|
||||
Go <code>interface</code>, <code>channel</code>, and <code>map</code>
|
||||
types have no corresponding C type (<code>interface</code> is a
|
||||
@@ -432,7 +314,6 @@ which one is difficult to predict in general; use a cast. C <code>union</code>
|
||||
types have no corresponding Go type. C <code>struct</code> types containing
|
||||
bitfields have no corresponding Go type. C++ <code>class</code> types have
|
||||
no corresponding Go type.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Memory allocation is completely different between C and Go, as Go uses
|
||||
@@ -444,56 +325,43 @@ while the Go side still has a copy the program will fail. When passing a
|
||||
pointer from Go to C, the Go function must retain a visible copy of it in
|
||||
some Go variable. Otherwise the Go garbage collector may delete the
|
||||
pointer while the C function is still using it.
|
||||
</p>
|
||||
|
||||
<h3 id="Function_names">Function names</h3>
|
||||
|
||||
<p>
|
||||
Go code can call C functions directly using a Go extension implemented
|
||||
in gccgo: a function declaration may be preceded by
|
||||
<code>//extern NAME</code>. For example, here is how the C function
|
||||
in <code>gccgo</code>: a function declaration may be followed by
|
||||
<code>__asm__("NAME")</code>. For example, here is how the C function
|
||||
<code>open</code> can be declared in Go:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
//extern open
|
||||
func c_open(name *byte, mode int, perm int) int
|
||||
func c_open(name *byte, mode int, perm int) int __asm__ ("open");
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The C function naturally expects a NUL-terminated string, which in
|
||||
The C function naturally expects a nul terminated string, which in
|
||||
Go is equivalent to a pointer to an array (not a slice!) of
|
||||
<code>byte</code> with a terminating zero byte. So a sample call
|
||||
from Go would look like (after importing the <code>syscall</code> package):
|
||||
</p>
|
||||
from Go would look like (after importing the <code>os</code> package):
|
||||
|
||||
<pre>
|
||||
var name = [4]byte{'f', 'o', 'o', 0};
|
||||
i := c_open(&name[0], syscall.O_RDONLY, 0);
|
||||
i := c_open(&name[0], os.O_RDONLY, 0);
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
(this serves as an example only, to open a file in Go please use Go's
|
||||
<code>os.Open</code> function instead).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that if the C function can block, such as in a call
|
||||
to <code>read</code>, calling the C function may block the Go program.
|
||||
Unless you have a clear understanding of what you are doing, all calls
|
||||
between C and Go should be implemented through cgo or SWIG, as for
|
||||
the <code>gc</code> compiler.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The name of Go functions accessed from C is subject to change. At present
|
||||
the name of a Go function that does not have a receiver is
|
||||
<code>prefix.package.Functionname</code>. The prefix is set by
|
||||
the <code>-fgo-prefix</code> option used when the package is compiled;
|
||||
if the option is not used, the default is <code>go</code>.
|
||||
if the option is not used, the default is simply <code>go</code>.
|
||||
To call the function from C you must set the name using
|
||||
a GCC extension.
|
||||
</p>
|
||||
a <code>gcc</code> extension similar to the <code>gccgo</code>
|
||||
extension.
|
||||
|
||||
<pre>
|
||||
extern int go_function(int) __asm__ ("myprefix.mypackage.Function");
|
||||
@@ -503,25 +371,39 @@ extern int go_function(int) __asm__ ("myprefix.mypackage.Function");
|
||||
Automatic generation of Go declarations from C source code</h3>
|
||||
|
||||
<p>
|
||||
The Go version of GCC supports automatically generating
|
||||
Go declarations from C code. The facility is rather awkward, and most
|
||||
users should use the <a href="/cmd/cgo">cgo</a> program with
|
||||
the <code>-gccgo</code> option instead.
|
||||
</p>
|
||||
The Go version of <code>gcc</code> supports automatically generating
|
||||
Go declarations from C code. The facility is rather awkward at present,
|
||||
and a better mechanism is under development.
|
||||
|
||||
<p>
|
||||
Compile your C code as usual, and add the option
|
||||
<code>-fdump-go-spec=<var>FILENAME</var></code>. This will create the
|
||||
file <code><var>FILENAME</var></code> as a side effect of the
|
||||
compilation. This file will contain Go declarations for the types,
|
||||
variables and functions declared in the C code. C types that can not
|
||||
be represented in Go will be recorded as comments in the Go code. The
|
||||
generated file will not have a <code>package</code> declaration, but
|
||||
can otherwise be compiled directly by gccgo.
|
||||
</p>
|
||||
Compile your C code as usual, but replace <code>-c</code> with
|
||||
<code>-S -ggo</code>. The result will be an assembler file
|
||||
with a <code>.s</code> extension. This assembler file will contain
|
||||
comments beginning with #GO. Those comments are declarations in the Go
|
||||
language for the C types, variables and functions declared in the C code.
|
||||
C types which can not be represented in Go will contain the string INVALID.
|
||||
Unsupported macro definitions will be recorded as <code>unknowndefine</code>,
|
||||
and uses of <code>#undef</code> will be recorded as <code>undef</code>.
|
||||
So it is very approximately possible to get Go code by running
|
||||
|
||||
<pre>
|
||||
gcc -S -ggo foo.c
|
||||
grep '#GO' foo.s | grep -v INVALID | grep -v unknowndefine | grep -v undef > foo.go
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This procedure is full of unstated caveats and restrictions and we make no
|
||||
guarantee that it will not change in the future. It is more useful as a
|
||||
starting point for real Go code than as a regular procedure.
|
||||
</p>
|
||||
|
||||
<h2 id="RTEMS_Port">RTEMS Port</h2>
|
||||
<p>
|
||||
The <code>gccgo</code> compiler has been ported to <a href="http://www.rtems.com/">
|
||||
<code>RTEMS</code></a>. <code>RTEMS</code> is a real-time executive
|
||||
that provides a high performance environment for embedded applications
|
||||
on a range of processors and embedded hardware. The current <code>gccgo</code>
|
||||
port is for x86. The goal is to extend the port to most of the
|
||||
<a href="http://www.rtems.org/wiki/index.php/SupportedCPUs">
|
||||
architectures supported by <code>RTEMS</code></a>. For more information on the port,
|
||||
as well as instructions on how to install it, please see this
|
||||
<a href="http://www.rtems.com/wiki/index.php/GCCGoRTEMS"><code>RTEMS</code> Wiki page</a>.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user