From 25dc8ca80072fdb3817d0319815ebffb3127b256 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Tue, 2 Oct 2012 18:29:58 -0700 Subject: [PATCH] full book wip --- src/001-title/title.html | 5 +++ src/002-contents/contents.html | 7 ++++ src/003-introduction/introduction.html | 5 +++ .../hello-world.go | 0 .../hello-world.sh | 0 src/{002-values => 005-values}/values.go | 0 src/{002-values => 005-values}/values.sh | 0 .../variables.go | 0 .../variables.sh | 0 .../inline-assignment.go | 0 .../inline-assignment.sh | 0 .../constants.go | 0 .../constants.sh | 0 src/{006-for => 009-for}/for.go | 0 src/{006-for => 009-for}/for.sh | 0 src/{007-if-else => 010-if-else}/if-else.go | 0 src/{007-if-else => 010-if-else}/if-else.sh | 0 src/{008-switch => 011-switch}/switch.go | 0 src/{008-switch => 011-switch}/switch.sh | 0 src/{009-arrays => 012-arrays}/arrays.go | 0 src/{010-range => 013-range}/range.go | 0 src/{011-slices => 014-slices}/slices.go | 0 src/{012-maps => 015-maps}/maps.go | 0 .../functions.go | 0 .../multiple-returns-values.go | 0 .../returns.sh | 0 .../varadic-functions.go | 0 .../varadic-functions.sh | 0 .../closures.go | 0 .../recursion.go | 0 src/{018-defer => 021-defer}/defer.go | 0 src/{019-panic => 022-panic}/panic.go | 0 src/{019-panic => 022-panic}/panic.sh | 0 .../pointers.go | 0 src/{021-new => 024-new}/new.go | 0 src/{022-structs => 025-structs}/structs.go | 0 src/{023-methods => 026-methods}/methods.go | 0 .../embedding.go | 0 .../interfaces.go | 0 src/{026-errors => 029-errors}/errors.go | 0 .../ok-guards.go | 0 .../goroutines.go | 0 .../concurrent-goroutines.go | 0 .../channels.go | 0 .../channel-buffering.go | 0 .../channel-directions.go | 0 .../synchronization.go | 0 .../synchronization.sh | 0 src/{034-select => 037-select}/select.go | 0 .../timeouts.go | 0 .../081-scatter-gather.go | 0 .../rate-limiting.go | 0 .../worker-pools.go | 0 .../nonblocking-channel-operations.go | 0 .../closing-channels.go | 0 src/{041-timers => 044-timers}/timers.go | 0 src/{041-timers => 044-timers}/tiners.sh | 0 src/{042-tickers => 045-tickers}/tickers.go | 0 src/{042-tickers => 045-tickers}/tickers.sh | 0 .../state-goroutine.go | 0 .../state-mutex.go | 0 src/{045-sorting => 048-sorting}/sorting.go | 0 src/{045-sorting => 048-sorting}/sorting.sh | 0 .../sorting-by-functions.go | 0 .../sorting-by-functions.sh | 0 .../collection-functions.go | 0 .../string-functions.go | 0 .../string-formatting.go | 0 .../string-formatting.sh | 0 src/{050-regexs => 053-regexs}/regexs.go | 0 src/{050-regexs => 053-regexs}/regexs.sh | 0 src/{051-bytes => 054-bytes}/bytes.go | 0 src/{052-json => 055-json}/json.go | 0 src/{053-time => 056-time}/time.go | 0 src/{053-time => 056-time}/time.sh | 0 src/{054-epochs => 057-epochs}/epochs.go | 0 src/{054-epochs => 057-epochs}/epochs.sh | 0 .../elapsed-time.go | 0 .../random-numbers.go | 0 .../random-numbers.sh | 0 .../number-parsing.go | 0 .../number-parsing.sh | 0 src/{058-urls => 061-urls}/urls.go | 0 src/{058-urls => 061-urls}/urls.sh | 0 .../sha1-hashes.go | 0 .../sha1-hashes.sh | 0 .../base64-encoding.go | 0 .../reading-files.go | 0 .../writing-files.go | 0 .../line-filters.go | 0 .../line-filters.sh | 0 .../command-line-arguments.go | 0 .../command-line-arguments.sh | 0 .../command-line-flags.go | 0 .../environment-variables.go | 0 .../environment-variables.sh | 0 .../spawning-processes.go | 0 .../spawning-processes.sh | 0 .../execing-processes.go | 0 src/{069-signals => 072-signals}/signals.go | 0 src/{069-signals => 072-signals}/signals.sh | 0 src/{070-exit => 073-exit}/exit.go | 0 src/{070-exit => 073-exit}/exit.sh | 0 .../http-client.go | 0 .../https-client.go | 0 src/{073-redis => 076-redis}/redis.go | 0 src/{073-redis => 076-redis}/redis.sh | 0 .../postgres.go | 0 .../postgres.sh | 0 .../sending-email.go | 0 .../hello-web.go | 0 .../responses.go | 0 .../responses.sh | 0 .../request-routing.go | 0 .../request-routing.sh | 0 .../request-logging.go | 0 .../static-content.go | 0 .../static-content.sh | 0 .../basic-authentication.go | 0 .../canonical-hosts.go | 0 .../canonical-hosts.sh | 0 .../middleware.go | 0 .../middleware.sh | 0 .../graceful-shutdown.go | 0 .../graceful-shutdown.sh | 0 .../https-servers.go | 0 .../https-servers.sh | 0 src/index.txt | 7 ++-- tool/src/build-html.go | 38 ++++++++++++------- 129 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 src/001-title/title.html create mode 100644 src/002-contents/contents.html create mode 100644 src/003-introduction/introduction.html rename src/{001-hello-world => 004-hello-world}/hello-world.go (100%) rename src/{001-hello-world => 004-hello-world}/hello-world.sh (100%) rename src/{002-values => 005-values}/values.go (100%) rename src/{002-values => 005-values}/values.sh (100%) rename src/{003-variables => 006-variables}/variables.go (100%) rename src/{003-variables => 006-variables}/variables.sh (100%) rename src/{004-inline-assignment => 007-inline-assignment}/inline-assignment.go (100%) rename src/{004-inline-assignment => 007-inline-assignment}/inline-assignment.sh (100%) rename src/{005-constants => 008-constants}/constants.go (100%) rename src/{005-constants => 008-constants}/constants.sh (100%) rename src/{006-for => 009-for}/for.go (100%) rename src/{006-for => 009-for}/for.sh (100%) rename src/{007-if-else => 010-if-else}/if-else.go (100%) rename src/{007-if-else => 010-if-else}/if-else.sh (100%) rename src/{008-switch => 011-switch}/switch.go (100%) rename src/{008-switch => 011-switch}/switch.sh (100%) rename src/{009-arrays => 012-arrays}/arrays.go (100%) rename src/{010-range => 013-range}/range.go (100%) rename src/{011-slices => 014-slices}/slices.go (100%) rename src/{012-maps => 015-maps}/maps.go (100%) rename src/{013-functions => 016-functions}/functions.go (100%) rename src/{014-multiple-return-values => 017-multiple-return-values}/multiple-returns-values.go (100%) rename src/{014-multiple-return-values => 017-multiple-return-values}/returns.sh (100%) rename src/{015-varadic-functions => 018-varadic-functions}/varadic-functions.go (100%) rename src/{015-varadic-functions => 018-varadic-functions}/varadic-functions.sh (100%) rename src/{016-closures => 019-closures}/closures.go (100%) rename src/{017-recursion => 020-recursion}/recursion.go (100%) rename src/{018-defer => 021-defer}/defer.go (100%) rename src/{019-panic => 022-panic}/panic.go (100%) rename src/{019-panic => 022-panic}/panic.sh (100%) rename src/{020-pointers => 023-pointers}/pointers.go (100%) rename src/{021-new => 024-new}/new.go (100%) rename src/{022-structs => 025-structs}/structs.go (100%) rename src/{023-methods => 026-methods}/methods.go (100%) rename src/{024-embedding => 027-embedding}/embedding.go (100%) rename src/{025-interfaces => 028-interfaces}/interfaces.go (100%) rename src/{026-errors => 029-errors}/errors.go (100%) rename src/{027-ok-guards => 030-ok-guards}/ok-guards.go (100%) rename src/{028-goroutines => 031-goroutines}/goroutines.go (100%) rename src/{029-concurrent-goroutines => 032-concurrent-goroutines}/concurrent-goroutines.go (100%) rename src/{030-channels => 033-channels}/channels.go (100%) rename src/{031-channel-buffering => 034-channel-buffering}/channel-buffering.go (100%) rename src/{032-channel-directions => 035-channel-directions}/channel-directions.go (100%) rename src/{033-synchronization => 036-synchronization}/synchronization.go (100%) rename src/{033-synchronization => 036-synchronization}/synchronization.sh (100%) rename src/{034-select => 037-select}/select.go (100%) rename src/{035-timeouts => 038-timeouts}/timeouts.go (100%) rename src/{036-scatter-gather => 039-scatter-gather}/081-scatter-gather.go (100%) rename src/{037-rate-limiting => 040-rate-limiting}/rate-limiting.go (100%) rename src/{038-worker-pools => 041-worker-pools}/worker-pools.go (100%) rename src/{039-nonblocking-channel-operations => 042-nonblocking-channel-operations}/nonblocking-channel-operations.go (100%) rename src/{040-closing-channels => 043-closing-channels}/closing-channels.go (100%) rename src/{041-timers => 044-timers}/timers.go (100%) rename src/{041-timers => 044-timers}/tiners.sh (100%) rename src/{042-tickers => 045-tickers}/tickers.go (100%) rename src/{042-tickers => 045-tickers}/tickers.sh (100%) rename src/{043-state-goroutine => 046-state-goroutine}/state-goroutine.go (100%) rename src/{044-state-mutex => 047-state-mutex}/state-mutex.go (100%) rename src/{045-sorting => 048-sorting}/sorting.go (100%) rename src/{045-sorting => 048-sorting}/sorting.sh (100%) rename src/{046-sorting-by-functions => 049-sorting-by-functions}/sorting-by-functions.go (100%) rename src/{046-sorting-by-functions => 049-sorting-by-functions}/sorting-by-functions.sh (100%) rename src/{047-collection-functions => 050-collection-functions}/collection-functions.go (100%) rename src/{048-string-functions => 051-string-functions}/string-functions.go (100%) rename src/{049-string-formatting => 052-string-formatting}/string-formatting.go (100%) rename src/{049-string-formatting => 052-string-formatting}/string-formatting.sh (100%) rename src/{050-regexs => 053-regexs}/regexs.go (100%) rename src/{050-regexs => 053-regexs}/regexs.sh (100%) rename src/{051-bytes => 054-bytes}/bytes.go (100%) rename src/{052-json => 055-json}/json.go (100%) rename src/{053-time => 056-time}/time.go (100%) rename src/{053-time => 056-time}/time.sh (100%) rename src/{054-epochs => 057-epochs}/epochs.go (100%) rename src/{054-epochs => 057-epochs}/epochs.sh (100%) rename src/{055-elapsed-time => 058-elapsed-time}/elapsed-time.go (100%) rename src/{056-random-numbers => 059-random-numbers}/random-numbers.go (100%) rename src/{056-random-numbers => 059-random-numbers}/random-numbers.sh (100%) rename src/{057-number-parsing => 060-number-parsing}/number-parsing.go (100%) rename src/{057-number-parsing => 060-number-parsing}/number-parsing.sh (100%) rename src/{058-urls => 061-urls}/urls.go (100%) rename src/{058-urls => 061-urls}/urls.sh (100%) rename src/{059-sha1-hashes => 062-sha1-hashes}/sha1-hashes.go (100%) rename src/{059-sha1-hashes => 062-sha1-hashes}/sha1-hashes.sh (100%) rename src/{060-base64-encoding => 063-base64-encoding}/base64-encoding.go (100%) rename src/{061-reading-files => 064-reading-files}/reading-files.go (100%) rename src/{062-writing-files => 065-writing-files}/writing-files.go (100%) rename src/{063-line-filters => 066-line-filters}/line-filters.go (100%) rename src/{063-line-filters => 066-line-filters}/line-filters.sh (100%) rename src/{064-command-line-arguments => 067-command-line-arguments}/command-line-arguments.go (100%) rename src/{064-command-line-arguments => 067-command-line-arguments}/command-line-arguments.sh (100%) rename src/{065-command-line-flags => 068-command-line-flags}/command-line-flags.go (100%) rename src/{066-environment-variables => 069-environment-variables}/environment-variables.go (100%) rename src/{066-environment-variables => 069-environment-variables}/environment-variables.sh (100%) rename src/{067-spawning-processes => 070-spawning-processes}/spawning-processes.go (100%) rename src/{067-spawning-processes => 070-spawning-processes}/spawning-processes.sh (100%) rename src/{068-execing-processes => 071-execing-processes}/execing-processes.go (100%) rename src/{069-signals => 072-signals}/signals.go (100%) rename src/{069-signals => 072-signals}/signals.sh (100%) rename src/{070-exit => 073-exit}/exit.go (100%) rename src/{070-exit => 073-exit}/exit.sh (100%) rename src/{071-http-client => 074-http-client}/http-client.go (100%) rename src/{072-https-client => 075-https-client}/https-client.go (100%) rename src/{073-redis => 076-redis}/redis.go (100%) rename src/{073-redis => 076-redis}/redis.sh (100%) rename src/{074-postgres => 077-postgres}/postgres.go (100%) rename src/{074-postgres => 077-postgres}/postgres.sh (100%) rename src/{075-sending-email => 078-sending-email}/sending-email.go (100%) rename src/{076-hello-web => 079-hello-web}/hello-web.go (100%) rename src/{077-responses => 080-responses}/responses.go (100%) rename src/{077-responses => 080-responses}/responses.sh (100%) rename src/{078-request-routing => 081-request-routing}/request-routing.go (100%) rename src/{078-request-routing => 081-request-routing}/request-routing.sh (100%) rename src/{079-request-logging => 082-request-logging}/request-logging.go (100%) rename src/{080-static-content => 083-static-content}/static-content.go (100%) rename src/{080-static-content => 083-static-content}/static-content.sh (100%) rename src/{081-basic-authentication => 084-basic-authentication}/basic-authentication.go (100%) rename src/{082-canonical-hosts => 085-canonical-hosts}/canonical-hosts.go (100%) rename src/{082-canonical-hosts => 085-canonical-hosts}/canonical-hosts.sh (100%) rename src/{083-middleware => 086-middleware}/middleware.go (100%) rename src/{083-middleware => 086-middleware}/middleware.sh (100%) rename src/{084-graceful-shutdown => 087-graceful-shutdown}/graceful-shutdown.go (100%) rename src/{084-graceful-shutdown => 087-graceful-shutdown}/graceful-shutdown.sh (100%) rename src/{085-https-servers => 088-https-servers}/https-servers.go (100%) rename src/{085-https-servers => 088-https-servers}/https-servers.sh (100%) diff --git a/src/001-title/title.html b/src/001-title/title.html new file mode 100644 index 0000000..f759930 --- /dev/null +++ b/src/001-title/title.html @@ -0,0 +1,5 @@ +

Go by Example

+ +

Mark McGranaghan

+ +

Version eb9cf61d

diff --git a/src/002-contents/contents.html b/src/002-contents/contents.html new file mode 100644 index 0000000..1e8b6cd --- /dev/null +++ b/src/002-contents/contents.html @@ -0,0 +1,7 @@ +

Contents

+ + diff --git a/src/003-introduction/introduction.html b/src/003-introduction/introduction.html new file mode 100644 index 0000000..12eb89f --- /dev/null +++ b/src/003-introduction/introduction.html @@ -0,0 +1,5 @@ +

Introduction

+ +

Why you should care.

+ +

This is why.

diff --git a/src/001-hello-world/hello-world.go b/src/004-hello-world/hello-world.go similarity index 100% rename from src/001-hello-world/hello-world.go rename to src/004-hello-world/hello-world.go diff --git a/src/001-hello-world/hello-world.sh b/src/004-hello-world/hello-world.sh similarity index 100% rename from src/001-hello-world/hello-world.sh rename to src/004-hello-world/hello-world.sh diff --git a/src/002-values/values.go b/src/005-values/values.go similarity index 100% rename from src/002-values/values.go rename to src/005-values/values.go diff --git a/src/002-values/values.sh b/src/005-values/values.sh similarity index 100% rename from src/002-values/values.sh rename to src/005-values/values.sh diff --git a/src/003-variables/variables.go b/src/006-variables/variables.go similarity index 100% rename from src/003-variables/variables.go rename to src/006-variables/variables.go diff --git a/src/003-variables/variables.sh b/src/006-variables/variables.sh similarity index 100% rename from src/003-variables/variables.sh rename to src/006-variables/variables.sh diff --git a/src/004-inline-assignment/inline-assignment.go b/src/007-inline-assignment/inline-assignment.go similarity index 100% rename from src/004-inline-assignment/inline-assignment.go rename to src/007-inline-assignment/inline-assignment.go diff --git a/src/004-inline-assignment/inline-assignment.sh b/src/007-inline-assignment/inline-assignment.sh similarity index 100% rename from src/004-inline-assignment/inline-assignment.sh rename to src/007-inline-assignment/inline-assignment.sh diff --git a/src/005-constants/constants.go b/src/008-constants/constants.go similarity index 100% rename from src/005-constants/constants.go rename to src/008-constants/constants.go diff --git a/src/005-constants/constants.sh b/src/008-constants/constants.sh similarity index 100% rename from src/005-constants/constants.sh rename to src/008-constants/constants.sh diff --git a/src/006-for/for.go b/src/009-for/for.go similarity index 100% rename from src/006-for/for.go rename to src/009-for/for.go diff --git a/src/006-for/for.sh b/src/009-for/for.sh similarity index 100% rename from src/006-for/for.sh rename to src/009-for/for.sh diff --git a/src/007-if-else/if-else.go b/src/010-if-else/if-else.go similarity index 100% rename from src/007-if-else/if-else.go rename to src/010-if-else/if-else.go diff --git a/src/007-if-else/if-else.sh b/src/010-if-else/if-else.sh similarity index 100% rename from src/007-if-else/if-else.sh rename to src/010-if-else/if-else.sh diff --git a/src/008-switch/switch.go b/src/011-switch/switch.go similarity index 100% rename from src/008-switch/switch.go rename to src/011-switch/switch.go diff --git a/src/008-switch/switch.sh b/src/011-switch/switch.sh similarity index 100% rename from src/008-switch/switch.sh rename to src/011-switch/switch.sh diff --git a/src/009-arrays/arrays.go b/src/012-arrays/arrays.go similarity index 100% rename from src/009-arrays/arrays.go rename to src/012-arrays/arrays.go diff --git a/src/010-range/range.go b/src/013-range/range.go similarity index 100% rename from src/010-range/range.go rename to src/013-range/range.go diff --git a/src/011-slices/slices.go b/src/014-slices/slices.go similarity index 100% rename from src/011-slices/slices.go rename to src/014-slices/slices.go diff --git a/src/012-maps/maps.go b/src/015-maps/maps.go similarity index 100% rename from src/012-maps/maps.go rename to src/015-maps/maps.go diff --git a/src/013-functions/functions.go b/src/016-functions/functions.go similarity index 100% rename from src/013-functions/functions.go rename to src/016-functions/functions.go diff --git a/src/014-multiple-return-values/multiple-returns-values.go b/src/017-multiple-return-values/multiple-returns-values.go similarity index 100% rename from src/014-multiple-return-values/multiple-returns-values.go rename to src/017-multiple-return-values/multiple-returns-values.go diff --git a/src/014-multiple-return-values/returns.sh b/src/017-multiple-return-values/returns.sh similarity index 100% rename from src/014-multiple-return-values/returns.sh rename to src/017-multiple-return-values/returns.sh diff --git a/src/015-varadic-functions/varadic-functions.go b/src/018-varadic-functions/varadic-functions.go similarity index 100% rename from src/015-varadic-functions/varadic-functions.go rename to src/018-varadic-functions/varadic-functions.go diff --git a/src/015-varadic-functions/varadic-functions.sh b/src/018-varadic-functions/varadic-functions.sh similarity index 100% rename from src/015-varadic-functions/varadic-functions.sh rename to src/018-varadic-functions/varadic-functions.sh diff --git a/src/016-closures/closures.go b/src/019-closures/closures.go similarity index 100% rename from src/016-closures/closures.go rename to src/019-closures/closures.go diff --git a/src/017-recursion/recursion.go b/src/020-recursion/recursion.go similarity index 100% rename from src/017-recursion/recursion.go rename to src/020-recursion/recursion.go diff --git a/src/018-defer/defer.go b/src/021-defer/defer.go similarity index 100% rename from src/018-defer/defer.go rename to src/021-defer/defer.go diff --git a/src/019-panic/panic.go b/src/022-panic/panic.go similarity index 100% rename from src/019-panic/panic.go rename to src/022-panic/panic.go diff --git a/src/019-panic/panic.sh b/src/022-panic/panic.sh similarity index 100% rename from src/019-panic/panic.sh rename to src/022-panic/panic.sh diff --git a/src/020-pointers/pointers.go b/src/023-pointers/pointers.go similarity index 100% rename from src/020-pointers/pointers.go rename to src/023-pointers/pointers.go diff --git a/src/021-new/new.go b/src/024-new/new.go similarity index 100% rename from src/021-new/new.go rename to src/024-new/new.go diff --git a/src/022-structs/structs.go b/src/025-structs/structs.go similarity index 100% rename from src/022-structs/structs.go rename to src/025-structs/structs.go diff --git a/src/023-methods/methods.go b/src/026-methods/methods.go similarity index 100% rename from src/023-methods/methods.go rename to src/026-methods/methods.go diff --git a/src/024-embedding/embedding.go b/src/027-embedding/embedding.go similarity index 100% rename from src/024-embedding/embedding.go rename to src/027-embedding/embedding.go diff --git a/src/025-interfaces/interfaces.go b/src/028-interfaces/interfaces.go similarity index 100% rename from src/025-interfaces/interfaces.go rename to src/028-interfaces/interfaces.go diff --git a/src/026-errors/errors.go b/src/029-errors/errors.go similarity index 100% rename from src/026-errors/errors.go rename to src/029-errors/errors.go diff --git a/src/027-ok-guards/ok-guards.go b/src/030-ok-guards/ok-guards.go similarity index 100% rename from src/027-ok-guards/ok-guards.go rename to src/030-ok-guards/ok-guards.go diff --git a/src/028-goroutines/goroutines.go b/src/031-goroutines/goroutines.go similarity index 100% rename from src/028-goroutines/goroutines.go rename to src/031-goroutines/goroutines.go diff --git a/src/029-concurrent-goroutines/concurrent-goroutines.go b/src/032-concurrent-goroutines/concurrent-goroutines.go similarity index 100% rename from src/029-concurrent-goroutines/concurrent-goroutines.go rename to src/032-concurrent-goroutines/concurrent-goroutines.go diff --git a/src/030-channels/channels.go b/src/033-channels/channels.go similarity index 100% rename from src/030-channels/channels.go rename to src/033-channels/channels.go diff --git a/src/031-channel-buffering/channel-buffering.go b/src/034-channel-buffering/channel-buffering.go similarity index 100% rename from src/031-channel-buffering/channel-buffering.go rename to src/034-channel-buffering/channel-buffering.go diff --git a/src/032-channel-directions/channel-directions.go b/src/035-channel-directions/channel-directions.go similarity index 100% rename from src/032-channel-directions/channel-directions.go rename to src/035-channel-directions/channel-directions.go diff --git a/src/033-synchronization/synchronization.go b/src/036-synchronization/synchronization.go similarity index 100% rename from src/033-synchronization/synchronization.go rename to src/036-synchronization/synchronization.go diff --git a/src/033-synchronization/synchronization.sh b/src/036-synchronization/synchronization.sh similarity index 100% rename from src/033-synchronization/synchronization.sh rename to src/036-synchronization/synchronization.sh diff --git a/src/034-select/select.go b/src/037-select/select.go similarity index 100% rename from src/034-select/select.go rename to src/037-select/select.go diff --git a/src/035-timeouts/timeouts.go b/src/038-timeouts/timeouts.go similarity index 100% rename from src/035-timeouts/timeouts.go rename to src/038-timeouts/timeouts.go diff --git a/src/036-scatter-gather/081-scatter-gather.go b/src/039-scatter-gather/081-scatter-gather.go similarity index 100% rename from src/036-scatter-gather/081-scatter-gather.go rename to src/039-scatter-gather/081-scatter-gather.go diff --git a/src/037-rate-limiting/rate-limiting.go b/src/040-rate-limiting/rate-limiting.go similarity index 100% rename from src/037-rate-limiting/rate-limiting.go rename to src/040-rate-limiting/rate-limiting.go diff --git a/src/038-worker-pools/worker-pools.go b/src/041-worker-pools/worker-pools.go similarity index 100% rename from src/038-worker-pools/worker-pools.go rename to src/041-worker-pools/worker-pools.go diff --git a/src/039-nonblocking-channel-operations/nonblocking-channel-operations.go b/src/042-nonblocking-channel-operations/nonblocking-channel-operations.go similarity index 100% rename from src/039-nonblocking-channel-operations/nonblocking-channel-operations.go rename to src/042-nonblocking-channel-operations/nonblocking-channel-operations.go diff --git a/src/040-closing-channels/closing-channels.go b/src/043-closing-channels/closing-channels.go similarity index 100% rename from src/040-closing-channels/closing-channels.go rename to src/043-closing-channels/closing-channels.go diff --git a/src/041-timers/timers.go b/src/044-timers/timers.go similarity index 100% rename from src/041-timers/timers.go rename to src/044-timers/timers.go diff --git a/src/041-timers/tiners.sh b/src/044-timers/tiners.sh similarity index 100% rename from src/041-timers/tiners.sh rename to src/044-timers/tiners.sh diff --git a/src/042-tickers/tickers.go b/src/045-tickers/tickers.go similarity index 100% rename from src/042-tickers/tickers.go rename to src/045-tickers/tickers.go diff --git a/src/042-tickers/tickers.sh b/src/045-tickers/tickers.sh similarity index 100% rename from src/042-tickers/tickers.sh rename to src/045-tickers/tickers.sh diff --git a/src/043-state-goroutine/state-goroutine.go b/src/046-state-goroutine/state-goroutine.go similarity index 100% rename from src/043-state-goroutine/state-goroutine.go rename to src/046-state-goroutine/state-goroutine.go diff --git a/src/044-state-mutex/state-mutex.go b/src/047-state-mutex/state-mutex.go similarity index 100% rename from src/044-state-mutex/state-mutex.go rename to src/047-state-mutex/state-mutex.go diff --git a/src/045-sorting/sorting.go b/src/048-sorting/sorting.go similarity index 100% rename from src/045-sorting/sorting.go rename to src/048-sorting/sorting.go diff --git a/src/045-sorting/sorting.sh b/src/048-sorting/sorting.sh similarity index 100% rename from src/045-sorting/sorting.sh rename to src/048-sorting/sorting.sh diff --git a/src/046-sorting-by-functions/sorting-by-functions.go b/src/049-sorting-by-functions/sorting-by-functions.go similarity index 100% rename from src/046-sorting-by-functions/sorting-by-functions.go rename to src/049-sorting-by-functions/sorting-by-functions.go diff --git a/src/046-sorting-by-functions/sorting-by-functions.sh b/src/049-sorting-by-functions/sorting-by-functions.sh similarity index 100% rename from src/046-sorting-by-functions/sorting-by-functions.sh rename to src/049-sorting-by-functions/sorting-by-functions.sh diff --git a/src/047-collection-functions/collection-functions.go b/src/050-collection-functions/collection-functions.go similarity index 100% rename from src/047-collection-functions/collection-functions.go rename to src/050-collection-functions/collection-functions.go diff --git a/src/048-string-functions/string-functions.go b/src/051-string-functions/string-functions.go similarity index 100% rename from src/048-string-functions/string-functions.go rename to src/051-string-functions/string-functions.go diff --git a/src/049-string-formatting/string-formatting.go b/src/052-string-formatting/string-formatting.go similarity index 100% rename from src/049-string-formatting/string-formatting.go rename to src/052-string-formatting/string-formatting.go diff --git a/src/049-string-formatting/string-formatting.sh b/src/052-string-formatting/string-formatting.sh similarity index 100% rename from src/049-string-formatting/string-formatting.sh rename to src/052-string-formatting/string-formatting.sh diff --git a/src/050-regexs/regexs.go b/src/053-regexs/regexs.go similarity index 100% rename from src/050-regexs/regexs.go rename to src/053-regexs/regexs.go diff --git a/src/050-regexs/regexs.sh b/src/053-regexs/regexs.sh similarity index 100% rename from src/050-regexs/regexs.sh rename to src/053-regexs/regexs.sh diff --git a/src/051-bytes/bytes.go b/src/054-bytes/bytes.go similarity index 100% rename from src/051-bytes/bytes.go rename to src/054-bytes/bytes.go diff --git a/src/052-json/json.go b/src/055-json/json.go similarity index 100% rename from src/052-json/json.go rename to src/055-json/json.go diff --git a/src/053-time/time.go b/src/056-time/time.go similarity index 100% rename from src/053-time/time.go rename to src/056-time/time.go diff --git a/src/053-time/time.sh b/src/056-time/time.sh similarity index 100% rename from src/053-time/time.sh rename to src/056-time/time.sh diff --git a/src/054-epochs/epochs.go b/src/057-epochs/epochs.go similarity index 100% rename from src/054-epochs/epochs.go rename to src/057-epochs/epochs.go diff --git a/src/054-epochs/epochs.sh b/src/057-epochs/epochs.sh similarity index 100% rename from src/054-epochs/epochs.sh rename to src/057-epochs/epochs.sh diff --git a/src/055-elapsed-time/elapsed-time.go b/src/058-elapsed-time/elapsed-time.go similarity index 100% rename from src/055-elapsed-time/elapsed-time.go rename to src/058-elapsed-time/elapsed-time.go diff --git a/src/056-random-numbers/random-numbers.go b/src/059-random-numbers/random-numbers.go similarity index 100% rename from src/056-random-numbers/random-numbers.go rename to src/059-random-numbers/random-numbers.go diff --git a/src/056-random-numbers/random-numbers.sh b/src/059-random-numbers/random-numbers.sh similarity index 100% rename from src/056-random-numbers/random-numbers.sh rename to src/059-random-numbers/random-numbers.sh diff --git a/src/057-number-parsing/number-parsing.go b/src/060-number-parsing/number-parsing.go similarity index 100% rename from src/057-number-parsing/number-parsing.go rename to src/060-number-parsing/number-parsing.go diff --git a/src/057-number-parsing/number-parsing.sh b/src/060-number-parsing/number-parsing.sh similarity index 100% rename from src/057-number-parsing/number-parsing.sh rename to src/060-number-parsing/number-parsing.sh diff --git a/src/058-urls/urls.go b/src/061-urls/urls.go similarity index 100% rename from src/058-urls/urls.go rename to src/061-urls/urls.go diff --git a/src/058-urls/urls.sh b/src/061-urls/urls.sh similarity index 100% rename from src/058-urls/urls.sh rename to src/061-urls/urls.sh diff --git a/src/059-sha1-hashes/sha1-hashes.go b/src/062-sha1-hashes/sha1-hashes.go similarity index 100% rename from src/059-sha1-hashes/sha1-hashes.go rename to src/062-sha1-hashes/sha1-hashes.go diff --git a/src/059-sha1-hashes/sha1-hashes.sh b/src/062-sha1-hashes/sha1-hashes.sh similarity index 100% rename from src/059-sha1-hashes/sha1-hashes.sh rename to src/062-sha1-hashes/sha1-hashes.sh diff --git a/src/060-base64-encoding/base64-encoding.go b/src/063-base64-encoding/base64-encoding.go similarity index 100% rename from src/060-base64-encoding/base64-encoding.go rename to src/063-base64-encoding/base64-encoding.go diff --git a/src/061-reading-files/reading-files.go b/src/064-reading-files/reading-files.go similarity index 100% rename from src/061-reading-files/reading-files.go rename to src/064-reading-files/reading-files.go diff --git a/src/062-writing-files/writing-files.go b/src/065-writing-files/writing-files.go similarity index 100% rename from src/062-writing-files/writing-files.go rename to src/065-writing-files/writing-files.go diff --git a/src/063-line-filters/line-filters.go b/src/066-line-filters/line-filters.go similarity index 100% rename from src/063-line-filters/line-filters.go rename to src/066-line-filters/line-filters.go diff --git a/src/063-line-filters/line-filters.sh b/src/066-line-filters/line-filters.sh similarity index 100% rename from src/063-line-filters/line-filters.sh rename to src/066-line-filters/line-filters.sh diff --git a/src/064-command-line-arguments/command-line-arguments.go b/src/067-command-line-arguments/command-line-arguments.go similarity index 100% rename from src/064-command-line-arguments/command-line-arguments.go rename to src/067-command-line-arguments/command-line-arguments.go diff --git a/src/064-command-line-arguments/command-line-arguments.sh b/src/067-command-line-arguments/command-line-arguments.sh similarity index 100% rename from src/064-command-line-arguments/command-line-arguments.sh rename to src/067-command-line-arguments/command-line-arguments.sh diff --git a/src/065-command-line-flags/command-line-flags.go b/src/068-command-line-flags/command-line-flags.go similarity index 100% rename from src/065-command-line-flags/command-line-flags.go rename to src/068-command-line-flags/command-line-flags.go diff --git a/src/066-environment-variables/environment-variables.go b/src/069-environment-variables/environment-variables.go similarity index 100% rename from src/066-environment-variables/environment-variables.go rename to src/069-environment-variables/environment-variables.go diff --git a/src/066-environment-variables/environment-variables.sh b/src/069-environment-variables/environment-variables.sh similarity index 100% rename from src/066-environment-variables/environment-variables.sh rename to src/069-environment-variables/environment-variables.sh diff --git a/src/067-spawning-processes/spawning-processes.go b/src/070-spawning-processes/spawning-processes.go similarity index 100% rename from src/067-spawning-processes/spawning-processes.go rename to src/070-spawning-processes/spawning-processes.go diff --git a/src/067-spawning-processes/spawning-processes.sh b/src/070-spawning-processes/spawning-processes.sh similarity index 100% rename from src/067-spawning-processes/spawning-processes.sh rename to src/070-spawning-processes/spawning-processes.sh diff --git a/src/068-execing-processes/execing-processes.go b/src/071-execing-processes/execing-processes.go similarity index 100% rename from src/068-execing-processes/execing-processes.go rename to src/071-execing-processes/execing-processes.go diff --git a/src/069-signals/signals.go b/src/072-signals/signals.go similarity index 100% rename from src/069-signals/signals.go rename to src/072-signals/signals.go diff --git a/src/069-signals/signals.sh b/src/072-signals/signals.sh similarity index 100% rename from src/069-signals/signals.sh rename to src/072-signals/signals.sh diff --git a/src/070-exit/exit.go b/src/073-exit/exit.go similarity index 100% rename from src/070-exit/exit.go rename to src/073-exit/exit.go diff --git a/src/070-exit/exit.sh b/src/073-exit/exit.sh similarity index 100% rename from src/070-exit/exit.sh rename to src/073-exit/exit.sh diff --git a/src/071-http-client/http-client.go b/src/074-http-client/http-client.go similarity index 100% rename from src/071-http-client/http-client.go rename to src/074-http-client/http-client.go diff --git a/src/072-https-client/https-client.go b/src/075-https-client/https-client.go similarity index 100% rename from src/072-https-client/https-client.go rename to src/075-https-client/https-client.go diff --git a/src/073-redis/redis.go b/src/076-redis/redis.go similarity index 100% rename from src/073-redis/redis.go rename to src/076-redis/redis.go diff --git a/src/073-redis/redis.sh b/src/076-redis/redis.sh similarity index 100% rename from src/073-redis/redis.sh rename to src/076-redis/redis.sh diff --git a/src/074-postgres/postgres.go b/src/077-postgres/postgres.go similarity index 100% rename from src/074-postgres/postgres.go rename to src/077-postgres/postgres.go diff --git a/src/074-postgres/postgres.sh b/src/077-postgres/postgres.sh similarity index 100% rename from src/074-postgres/postgres.sh rename to src/077-postgres/postgres.sh diff --git a/src/075-sending-email/sending-email.go b/src/078-sending-email/sending-email.go similarity index 100% rename from src/075-sending-email/sending-email.go rename to src/078-sending-email/sending-email.go diff --git a/src/076-hello-web/hello-web.go b/src/079-hello-web/hello-web.go similarity index 100% rename from src/076-hello-web/hello-web.go rename to src/079-hello-web/hello-web.go diff --git a/src/077-responses/responses.go b/src/080-responses/responses.go similarity index 100% rename from src/077-responses/responses.go rename to src/080-responses/responses.go diff --git a/src/077-responses/responses.sh b/src/080-responses/responses.sh similarity index 100% rename from src/077-responses/responses.sh rename to src/080-responses/responses.sh diff --git a/src/078-request-routing/request-routing.go b/src/081-request-routing/request-routing.go similarity index 100% rename from src/078-request-routing/request-routing.go rename to src/081-request-routing/request-routing.go diff --git a/src/078-request-routing/request-routing.sh b/src/081-request-routing/request-routing.sh similarity index 100% rename from src/078-request-routing/request-routing.sh rename to src/081-request-routing/request-routing.sh diff --git a/src/079-request-logging/request-logging.go b/src/082-request-logging/request-logging.go similarity index 100% rename from src/079-request-logging/request-logging.go rename to src/082-request-logging/request-logging.go diff --git a/src/080-static-content/static-content.go b/src/083-static-content/static-content.go similarity index 100% rename from src/080-static-content/static-content.go rename to src/083-static-content/static-content.go diff --git a/src/080-static-content/static-content.sh b/src/083-static-content/static-content.sh similarity index 100% rename from src/080-static-content/static-content.sh rename to src/083-static-content/static-content.sh diff --git a/src/081-basic-authentication/basic-authentication.go b/src/084-basic-authentication/basic-authentication.go similarity index 100% rename from src/081-basic-authentication/basic-authentication.go rename to src/084-basic-authentication/basic-authentication.go diff --git a/src/082-canonical-hosts/canonical-hosts.go b/src/085-canonical-hosts/canonical-hosts.go similarity index 100% rename from src/082-canonical-hosts/canonical-hosts.go rename to src/085-canonical-hosts/canonical-hosts.go diff --git a/src/082-canonical-hosts/canonical-hosts.sh b/src/085-canonical-hosts/canonical-hosts.sh similarity index 100% rename from src/082-canonical-hosts/canonical-hosts.sh rename to src/085-canonical-hosts/canonical-hosts.sh diff --git a/src/083-middleware/middleware.go b/src/086-middleware/middleware.go similarity index 100% rename from src/083-middleware/middleware.go rename to src/086-middleware/middleware.go diff --git a/src/083-middleware/middleware.sh b/src/086-middleware/middleware.sh similarity index 100% rename from src/083-middleware/middleware.sh rename to src/086-middleware/middleware.sh diff --git a/src/084-graceful-shutdown/graceful-shutdown.go b/src/087-graceful-shutdown/graceful-shutdown.go similarity index 100% rename from src/084-graceful-shutdown/graceful-shutdown.go rename to src/087-graceful-shutdown/graceful-shutdown.go diff --git a/src/084-graceful-shutdown/graceful-shutdown.sh b/src/087-graceful-shutdown/graceful-shutdown.sh similarity index 100% rename from src/084-graceful-shutdown/graceful-shutdown.sh rename to src/087-graceful-shutdown/graceful-shutdown.sh diff --git a/src/085-https-servers/https-servers.go b/src/088-https-servers/https-servers.go similarity index 100% rename from src/085-https-servers/https-servers.go rename to src/088-https-servers/https-servers.go diff --git a/src/085-https-servers/https-servers.sh b/src/088-https-servers/https-servers.sh similarity index 100% rename from src/085-https-servers/https-servers.sh rename to src/088-https-servers/https-servers.sh diff --git a/src/index.txt b/src/index.txt index 5ca06ff..fcf3ad9 100644 --- a/src/index.txt +++ b/src/index.txt @@ -1,6 +1,7 @@ -## introduction -introduction ~ -getting-started ~ +## header +title +contents +introduction ## basics hello-world diff --git a/tool/src/build-html.go b/tool/src/build-html.go index 899a7bd..87428af 100644 --- a/tool/src/build-html.go +++ b/tool/src/build-html.go @@ -41,6 +41,12 @@ func sha1Sum(s string) string { var cacheDir = "/tmp/gbe-book-cache" +func mustReadFile(path string) { + bytes, err := ioutil.ReadFile(path) + check(err) + return string(bytes) +} + func cachedRender(bin string, arg []string, src string) string { cachePath := cacheDir + "/pygmentize-" + strings.Join(arg, "-") + "-" + sha1Sum(src) cacheBytes, cacheErr := ioutil.ReadFile(cachePath) @@ -176,23 +182,27 @@ func main() { `) chapterPaths := mustGlob("./src/0*") for _, chapterPath := range chapterPaths { - fmt.Print(``) - sourcePaths := mustGlob(chapterPath + "/*") - for _, sourcePath := range sourcePaths { - segs := parseAndRenderSegs(sourcePath) - for _, seg := range segs { - codeClasses := "code" - if seg.code == "" { - codeClasses = codeClasses + " empty" + if strings.HasSuffix(chapterPath, ".html") { + + } else { + fmt.Printf(`
`, chapterPath) + sourcePaths := mustGlob(chapterPath + "/*") + for _, sourcePath := range sourcePaths { + segs := parseAndRenderSegs(sourcePath) + for _, seg := range segs { + codeClasses := "code" + if seg.code == "" { + codeClasses = codeClasses + " empty" + } + fmt.Printf( + ` + + + `, seg.docsRendered, codeClasses, seg.codeRendered) } - fmt.Printf( - ` - - - `, seg.docsRendered, codeClasses, seg.codeRendered) } + fmt.Print(`
%s%s
%s%s
`) } - fmt.Print(``) } fmt.Print(``) }