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(``) }