diff --git a/examples.txt b/examples.txt index 1ad6eca..58af207 100644 --- a/examples.txt +++ b/examples.txt @@ -1,74 +1,74 @@ -Hello World -Типы данных (Values) -Переменные (Variables) -Константы (Constants) -Цикл For -If/Else -Switch -Массивы (Arrays) -Срезы (Slices) -Карты (Maps) -Ряд (Range) -Функции (Functions) -Функции с множественным возвратом (Multiple Return Values) -Функции с переменным числом аргументов (Variadic Functions) -Замыкания (Closures) -Рекурсия (Recursion) -Указатели (Pointers) -Структуры (Structs) -Методы (Methods) -Интерфейсы (Interfaces) -Ошибки (Errors) -Горутины (Goroutines) -Каналы (Channels) -Буферизированный канал (Channel Buffering) -Синхронизация канала (Channel Synchronization) -Направления канала (Channel Directions) -Select -Тайм-ауты (Timeouts) -Неблокируемые операции в каналах (Non-Blocking Channel Operations) -Закрытие каналов (Closing Channels) -Перебор значений из каналов (Range over Channels) -Таймеры (Timers) -Тикеры (повторения) (Tickers) -Пулы воркеров (Worker Pools) -WaitGroups -Ограничение скорости (Rate Limiting) -Атомарные счетчики (Atomic Counters) -Мьютексы (Mutexes) -Управление состоянием горутин (Stateful Goroutines) -Сортировка (Sorting) -Сортировка через функции (Sorting by Functions) -Panic -Defer -Функции коллекции (Collection Functions) -Строковые функции (String Functions) -Форматирование строк (String Formatting) -Регулярные выражения (Regular Expressions) -JSON -XML -Время (Time) -Epoch -Форматирование времени (Time Formatting / Parsing) -Случайные числа (Random Numbers) -Парсинг чисел (Number Parsing) -Парсинг URL (URL Parsing) -Хеш SHA1 (SHA1 Hashes) -Кодирование Base64 (Base64 Encoding) -Чтение файлов (Reading Files) -Запись файлов (Writing Files) -Строковые фильтры (Line Filters) -Пути к файлам (File Paths) -Директории (Directories) -Временные файлы и директории (Temporary Files and Directories) -Тестирование (Testing) -Аргументы командной строки (Command-Line Arguments) -Флаги командной строки (Command-Line Flags) -Подкоманды командной строки (Command-Line Subcommands) -Переменные среды (Environment Variables) -HTTP клиенты (HTTP Clients) -HTTP серверы (HTTP Servers) -Порождающие процессы (Spawning Processes) -Исполняющие процессы (Exec'ing Processes) -Сигналы (Signals) -Выход (Exit) +Hello World|Hello World +Типы данных (Values)|Values +Переменные (Variables)|Variables +Константы (Constants)|Constants +Цикл For|For +If/Else|If/Else +Switch|Switch +Массивы (Arrays)|Arrays +Срезы (Slices)|Slices +Карты (Maps)|Maps +Ряд (Range)|Range +Функции (Functions)|Functions +Функции с множественным возвратом (Multiple Return Values)|Multiple Return Values +Функции с переменным числом аргументов (Variadic Functions)|Variadic Functions +Замыкания (Closures)|Closures +Рекурсия (Recursion)|Recursion +Указатели (Pointers)|Pointers +Структуры (Structs)|Structs +Методы (Methods)|Methods +Интерфейсы (Interfaces)|Interfaces +Ошибки (Errors)|Errors +Горутины (Goroutines)|Goroutines +Каналы (Channels)|Channels +Буферизированный канал (Channel Buffering)|Channel Buffering +Синхронизация канала (Channel Synchronization)|Channel Synchronization +Направления канала (Channel Directions)|Channel Directions +Select|Select +Тайм-ауты (Timeouts)|Timeouts +Неблокируемые операции в каналах (Non-Blocking Channel Operations)|Non-Blocking Channel Operations +Закрытие каналов (Closing Channels)|Closing Channels +Перебор значений из каналов (Range over Channels)|Range over Channels +Таймеры (Timers)|Timers +Тикеры (повторения) (Tickers)|Tickers +Пулы воркеров (Worker Pools)|Worker Pools +WaitGroups|WaitGroups +Ограничение скорости (Rate Limiting)|Rate Limiting +Атомарные счетчики (Atomic Counters)|Atomic Counters +Мьютексы (Mutexes)|Mutexes +Управление состоянием горутин (Stateful Goroutines)|Stateful Goroutines +Сортировка (Sorting)|Sorting +Сортировка через функции (Sorting by Functions)|Sorting by Functions +Panic|Panic +Defer|Defer +Функции коллекции (Collection Functions)|Collection Functions +Строковые функции (String Functions)|String Functions +Форматирование строк (String Formatting)|String Formatting +Регулярные выражения (Regular Expressions)|Regular Expressions +JSON|JSON +XML|XML +Время (Time)|Time +Epoch|Epoch +Форматирование времени (Time Formatting / Parsing)|Time Formatting / Parsing +Случайные числа (Random Numbers)|Random Numbers +Парсинг чисел (Number Parsing)|Number Parsing +Парсинг URL (URL Parsing)|URL Parsing +Хеш SHA1 (SHA1 Hashes)|SHA1 Hashes +Кодирование Base64 (Base64 Encoding)|Base64 Encoding +Чтение файлов (Reading Files)|Reading Files +Запись файлов (Writing Files)|Writing Files +Строковые фильтры (Line Filters)|Line Filters +Пути к файлам (File Paths)|File Paths +Директории (Directories)|Directories +Временные файлы и директории (Temporary Files and Directories)|Temporary Files and Directories +Тестирование (Testing)|Testing +Аргументы командной строки (Command-Line Arguments)|Command-Line Arguments +Флаги командной строки (Command-Line Flags)|Command-Line Flags +Подкоманды командной строки (Command-Line Subcommands)|Command-Line Subcommands +Переменные среды (Environment Variables)|Environment Variables +HTTP клиенты (HTTP Clients)|HTTP Clients +HTTP серверы (HTTP Servers)|HTTP Servers +Порождающие процессы (Spawning Processes)|Spawning Processes +Исполняющие процессы (Exec'ing Processes)|Exec'ing Processes +Сигналы (Signals)|Signals +Выход (Exit)|Exit diff --git a/examples/.hash b/examples/.hash new file mode 100644 index 0000000..8ab57f4 --- /dev/null +++ b/examples/.hash @@ -0,0 +1,2 @@ +da39a3ee5e6b4b0d3255bfef95601890afd80709 +UCPdVNrl0-P diff --git a/examples/arrays/arrays.hash b/examples/arrays/arrays.hash index 8ab57f4..ad69e96 100644 --- a/examples/arrays/arrays.hash +++ b/examples/arrays/arrays.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +cbd7ae7158cdb62fbd0f5a21c1f89a9a43369900 +CiZ6oDF6A_l diff --git a/examples/atomic-counters/atomic-counters.hash b/examples/atomic-counters/atomic-counters.hash index 8ab57f4..d8d3864 100644 --- a/examples/atomic-counters/atomic-counters.hash +++ b/examples/atomic-counters/atomic-counters.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +e1b3a73458ef10d4cfe093766d05503ed7706544 +aEOYD0chCYy diff --git a/examples/base64-encoding/base64-encoding.hash b/examples/base64-encoding/base64-encoding.hash index 717ff3f..b5f4766 100644 --- a/examples/base64-encoding/base64-encoding.hash +++ b/examples/base64-encoding/base64-encoding.hash @@ -1,2 +1,2 @@ -e0148b9b4acb01e849b8f678cba03f549d250c44 -V3oV1bvh94k +0a1abdfdd647b24082d46fd54645bc597fb86b83 +3E068RAuW3p diff --git a/examples/channel-buffering/channel-buffering.hash b/examples/channel-buffering/channel-buffering.hash index 8ab57f4..b8c3cbb 100644 --- a/examples/channel-buffering/channel-buffering.hash +++ b/examples/channel-buffering/channel-buffering.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +4d4cf7b115f26c12d7e188a2d25c66e64f34edfe +HNVSsVpnHXN diff --git a/examples/channel-directions/channel-directions.hash b/examples/channel-directions/channel-directions.hash index 8ab57f4..700e311 100644 --- a/examples/channel-directions/channel-directions.hash +++ b/examples/channel-directions/channel-directions.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +a0904bf943d61e4d220f29ef3a0e6f1368657e78 +uEeOmen99CF diff --git a/examples/channel-synchronization/channel-synchronization.hash b/examples/channel-synchronization/channel-synchronization.hash index 8ab57f4..16fea5e 100644 --- a/examples/channel-synchronization/channel-synchronization.hash +++ b/examples/channel-synchronization/channel-synchronization.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +29e4099160217bd2817aef8546927056b9ea4b12 +3NHqwE7Bwjz diff --git a/examples/channels/channels.hash b/examples/channels/channels.hash index 8ab57f4..eac8a35 100644 --- a/examples/channels/channels.hash +++ b/examples/channels/channels.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +92a2a89118f08e7ac1fcf82567c14a31e6a2fabe +jHsjIHrpHXV diff --git a/examples/closing-channels/closing-channels.hash b/examples/closing-channels/closing-channels.hash index 8ab57f4..16da6f6 100644 --- a/examples/closing-channels/closing-channels.hash +++ b/examples/closing-channels/closing-channels.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +67493a491669c559ceac851a959828a00ceb89eb +V8RCD4w9KY- diff --git a/examples/closures/closures.hash b/examples/closures/closures.hash index 8ab57f4..104a80b 100644 --- a/examples/closures/closures.hash +++ b/examples/closures/closures.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +5a274ea5c01af8573ce5c6382f41189446a8be09 +J2PladF_bU9 diff --git a/examples/collection-functions/collection-functions.hash b/examples/collection-functions/collection-functions.hash index 8ab57f4..49e6fd6 100644 --- a/examples/collection-functions/collection-functions.hash +++ b/examples/collection-functions/collection-functions.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +5e8a32a022ffb4f746bbdf101face52ca008aeba +urAoHQtRHro diff --git a/examples/command-line-arguments/command-line-arguments.hash b/examples/command-line-arguments/command-line-arguments.hash index 8ab57f4..b81990d 100644 --- a/examples/command-line-arguments/command-line-arguments.hash +++ b/examples/command-line-arguments/command-line-arguments.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +375f50de2467743174f0d60d0635a3198e031094 +wSDrVn9TIK5 diff --git a/examples/command-line-flags/command-line-flags.hash b/examples/command-line-flags/command-line-flags.hash index 8ab57f4..2262d76 100644 --- a/examples/command-line-flags/command-line-flags.hash +++ b/examples/command-line-flags/command-line-flags.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +e316c57acf4cc993f182f2d341a608a1eac4a551 +_r_-ZzDzQUH diff --git a/examples/command-line-subcommands/command-line-subcommands.hash b/examples/command-line-subcommands/command-line-subcommands.hash index 8ab57f4..f695b3c 100644 --- a/examples/command-line-subcommands/command-line-subcommands.hash +++ b/examples/command-line-subcommands/command-line-subcommands.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +7320b5803ad9875733c4ca9644600ae8a55009d8 +sr1FH0P_2Te diff --git a/examples/constants/constants.hash b/examples/constants/constants.hash index 8ab57f4..9cb2151 100644 --- a/examples/constants/constants.hash +++ b/examples/constants/constants.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +31b56e63896203b29fd3a08a1f5036ca62d6d0c2 +e1Vlh7LNMFJ diff --git a/examples/directories/directories.hash b/examples/directories/directories.hash index 8ab57f4..fa8c641 100644 --- a/examples/directories/directories.hash +++ b/examples/directories/directories.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +7df99bb0443cbe61600e6466782a66e76cf7d927 +6lC_YCFEXVl diff --git a/examples/environment-variables/environment-variables.hash b/examples/environment-variables/environment-variables.hash index 8ab57f4..3177ea5 100644 --- a/examples/environment-variables/environment-variables.hash +++ b/examples/environment-variables/environment-variables.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +61c3cd2ec3ab8fcd4528452e88fe25c0eafbb2de +--fC2aTdXEz diff --git a/examples/errors/errors.hash b/examples/errors/errors.hash index 8ab57f4..7c79ad8 100644 --- a/examples/errors/errors.hash +++ b/examples/errors/errors.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +91979262128065a70899eb9ee32da1549864b609 +9-iENtmoI5k diff --git a/examples/execing-processes/execing-processes.hash b/examples/execing-processes/execing-processes.hash index 8ab57f4..d0dcce3 100644 --- a/examples/execing-processes/execing-processes.hash +++ b/examples/execing-processes/execing-processes.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +878cb29aa644aef60217a2d97a586080cd783daa +dojmebwCvC4 diff --git a/examples/exit/exit.hash b/examples/exit/exit.hash index 8ab57f4..af49b62 100644 --- a/examples/exit/exit.hash +++ b/examples/exit/exit.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +450a55230493ea17b3b7aeef666f55f796c050a8 +BgQ_ag62q4k diff --git a/examples/file-paths/file-paths.hash b/examples/file-paths/file-paths.hash index 8ab57f4..fd63161 100644 --- a/examples/file-paths/file-paths.hash +++ b/examples/file-paths/file-paths.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +7bbdffb4411e01e9962593d1de16a5654fb780d4 +6VDVplbM_Sk diff --git a/examples/for/for.hash b/examples/for/for.hash index 8ab57f4..ff069d6 100644 --- a/examples/for/for.hash +++ b/examples/for/for.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +c478d7d6259b800c42307c0d520fb669109cb2f7 +Fv7uI0y_EWr diff --git a/examples/functions/functions.hash b/examples/functions/functions.hash index 8ab57f4..742cfe2 100644 --- a/examples/functions/functions.hash +++ b/examples/functions/functions.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +fe343c61ebf68660290e3717592e7904c47abad5 +4sH5Tv_SBoU diff --git a/examples/goroutines/goroutines.hash b/examples/goroutines/goroutines.hash index 8ab57f4..ab46c61 100644 --- a/examples/goroutines/goroutines.hash +++ b/examples/goroutines/goroutines.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +9de125c9da86967491563075071ccd110b95b8ef +79i2V9dLU15 diff --git a/examples/http-clients/http-clients.hash b/examples/http-clients/http-clients.hash index e550dd5..8f7dd6a 100644 --- a/examples/http-clients/http-clients.hash +++ b/examples/http-clients/http-clients.hash @@ -1,2 +1,2 @@ -ec8fd69aa19e54a7ea05d2a911f09d3a98f0396c -VxYIifr_UuH +4efc6eb143a0e04132f16fcf929f7eed232b897d +8Z80D4rlbaE diff --git a/examples/http-servers/http-servers.hash b/examples/http-servers/http-servers.hash index a491ac1..553440b 100644 --- a/examples/http-servers/http-servers.hash +++ b/examples/http-servers/http-servers.hash @@ -1,2 +1,2 @@ -a4e8d30b7a6f3a6abd96b916d81ce5930bad94f9 -lNuS9ysZmxH +0282a23b343fbbbf9e3cb32d1efd934c9d707d26 +xndCIK5Wo-Y diff --git a/examples/interfaces/interfaces.hash b/examples/interfaces/interfaces.hash index 8ab57f4..e0bd9e8 100644 --- a/examples/interfaces/interfaces.hash +++ b/examples/interfaces/interfaces.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +e09278982d7d148dd22c45730d0820659a7ecae8 +bS2bkTzP8cG diff --git a/examples/line-filters/line-filters.hash b/examples/line-filters/line-filters.hash index 8ab57f4..298af0b 100644 --- a/examples/line-filters/line-filters.hash +++ b/examples/line-filters/line-filters.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +92a88a19fb7453935093e2ae893fcef18432f596 +dLiHA3PDCFp diff --git a/examples/maps/maps.hash b/examples/maps/maps.hash index 8ab57f4..3f261eb 100644 --- a/examples/maps/maps.hash +++ b/examples/maps/maps.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +df6205e7069d3914f2a40940696755f4b6343a9b +HjBZNUEcF_e diff --git a/examples/methods/methods.hash b/examples/methods/methods.hash index 8ab57f4..37ab1b3 100644 --- a/examples/methods/methods.hash +++ b/examples/methods/methods.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +b3128d2e4d2238e56d99bfc7138389257076871f +qfALObNYETK diff --git a/examples/multiple-return-values/multiple-return-values.hash b/examples/multiple-return-values/multiple-return-values.hash index 8ab57f4..9a8cf5c 100644 --- a/examples/multiple-return-values/multiple-return-values.hash +++ b/examples/multiple-return-values/multiple-return-values.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +9cfe1eb1a10a8977bee1581389953af18afc9bc0 +6Khmls9Dsin diff --git a/examples/mutexes/mutexes.hash b/examples/mutexes/mutexes.hash index 8ab57f4..501066e 100644 --- a/examples/mutexes/mutexes.hash +++ b/examples/mutexes/mutexes.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +8c7db363d911ef04d1340ff195da03a5373b79ab +USO1aTX_xMe diff --git a/examples/non-blocking-channel-operations/non-blocking-channel-operations.hash b/examples/non-blocking-channel-operations/non-blocking-channel-operations.hash index 8ab57f4..70fa503 100644 --- a/examples/non-blocking-channel-operations/non-blocking-channel-operations.hash +++ b/examples/non-blocking-channel-operations/non-blocking-channel-operations.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +3b01f109970c31ffb1c67cfea86a8eaa2959f7e0 +FokCtF5TvgL diff --git a/examples/number-parsing/number-parsing.hash b/examples/number-parsing/number-parsing.hash index 8ab57f4..40ced04 100644 --- a/examples/number-parsing/number-parsing.hash +++ b/examples/number-parsing/number-parsing.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +9b4a9b30f02201adf86ab6c6abc60e23088026be +4PKUrIjNyTE diff --git a/examples/pointers/pointers.hash b/examples/pointers/pointers.hash index 8ab57f4..69d7ef2 100644 --- a/examples/pointers/pointers.hash +++ b/examples/pointers/pointers.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +909a2f7a79ef942a544292b283a964ae530fd612 +VHnMkOQfQea diff --git a/examples/random-numbers/random-numbers.hash b/examples/random-numbers/random-numbers.hash index 8ab57f4..acd1836 100644 --- a/examples/random-numbers/random-numbers.hash +++ b/examples/random-numbers/random-numbers.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +03975452ff4c127a4a78897643ce3eca0b90b239 +CKeOTktHnJe diff --git a/examples/range-over-channels/range-over-channels.hash b/examples/range-over-channels/range-over-channels.hash index 8ab57f4..0200e30 100644 --- a/examples/range-over-channels/range-over-channels.hash +++ b/examples/range-over-channels/range-over-channels.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +a2f106b835828ac784feffb869604e059d788680 +zbl7ytLnFCK diff --git a/examples/range/range.hash b/examples/range/range.hash index 8ab57f4..a1df701 100644 --- a/examples/range/range.hash +++ b/examples/range/range.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +f8c6ffeaa1f52aeff136779442bbd160313a6b32 +4GBukIe-7ie diff --git a/examples/rate-limiting/rate-limiting.hash b/examples/rate-limiting/rate-limiting.hash index 8ab57f4..19e0c2c 100644 --- a/examples/rate-limiting/rate-limiting.hash +++ b/examples/rate-limiting/rate-limiting.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +a93813bfc920c685c55bf09a3425f63fcc4a542b +rC0qLhImKAo diff --git a/examples/reading-files/reading-files.hash b/examples/reading-files/reading-files.hash index 8ab57f4..24886b8 100644 --- a/examples/reading-files/reading-files.hash +++ b/examples/reading-files/reading-files.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +176b57caf5a053e3707da299ca9fbb78314d283f +m6mvXlZtHTX diff --git a/examples/recursion/recursion.hash b/examples/recursion/recursion.hash index 8ab57f4..26a2e36 100644 --- a/examples/recursion/recursion.hash +++ b/examples/recursion/recursion.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +b75f7597af0526d0fefb481ef7987b5e186c0c04 +oPbHEHLaRrN diff --git a/examples/regular-expressions/regular-expressions.hash b/examples/regular-expressions/regular-expressions.hash index 8ab57f4..fbd8efc 100644 --- a/examples/regular-expressions/regular-expressions.hash +++ b/examples/regular-expressions/regular-expressions.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +984c5939e46284833637df8aa8dd38f51b571425 +GB_bgVcRKg2 diff --git a/examples/sha1-hashes/sha1-hashes.hash b/examples/sha1-hashes/sha1-hashes.hash index 5af2939..b69d352 100644 --- a/examples/sha1-hashes/sha1-hashes.hash +++ b/examples/sha1-hashes/sha1-hashes.hash @@ -1,2 +1,2 @@ -4cda643ba233014fe6b30966c37d4d0fcd4edbe8 -oqcrTfY4Ykd +f64d96d9e998d1c8821689af70580b3929a464cf +zhhfA6LqgFI diff --git a/examples/signals/signals.hash b/examples/signals/signals.hash index 8ab57f4..02bac3b 100644 --- a/examples/signals/signals.hash +++ b/examples/signals/signals.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +8e3867a11504ce30880c75e3d5ed74907a8ef1b5 +Xs9zJ53YIAa diff --git a/examples/slices/slices.hash b/examples/slices/slices.hash index 8ab57f4..a4ad5e8 100644 --- a/examples/slices/slices.hash +++ b/examples/slices/slices.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +97236c6deebee661d0bd1e696b12e4ea671d06ff +32lRsL-MYrP diff --git a/examples/sorting-by-functions/sorting-by-functions.hash b/examples/sorting-by-functions/sorting-by-functions.hash index 8ab57f4..374e267 100644 --- a/examples/sorting-by-functions/sorting-by-functions.hash +++ b/examples/sorting-by-functions/sorting-by-functions.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +0252f365e73e310a8f4dc4431f598ffcea3efc72 +VQrgvKKcvRg diff --git a/examples/sorting/sorting.hash b/examples/sorting/sorting.hash index 8ab57f4..c28118f 100644 --- a/examples/sorting/sorting.hash +++ b/examples/sorting/sorting.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +a059f86c91ed4084fb37f321a7def4ef88b62e67 +X9bT-mDzj4o diff --git a/examples/spawning-processes/spawning-processes.hash b/examples/spawning-processes/spawning-processes.hash index 8ab57f4..2ccab24 100644 --- a/examples/spawning-processes/spawning-processes.hash +++ b/examples/spawning-processes/spawning-processes.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +4984e90d62323e378c35e5c52d0c5646fd150d82 +2QNUQPuiFlR diff --git a/examples/stateful-goroutines/stateful-goroutines.hash b/examples/stateful-goroutines/stateful-goroutines.hash index 8ab57f4..bb70ee5 100644 --- a/examples/stateful-goroutines/stateful-goroutines.hash +++ b/examples/stateful-goroutines/stateful-goroutines.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +e7e07404454809cbacb719ad94e70726d22dacc1 +n_gVZus4DBP diff --git a/examples/string-formatting/string-formatting.hash b/examples/string-formatting/string-formatting.hash index 8ab57f4..a8fe8ea 100644 --- a/examples/string-formatting/string-formatting.hash +++ b/examples/string-formatting/string-formatting.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +8ffedfce40621f09c42f07459127279d66425d08 +TKe8eifne_2 diff --git a/examples/string-functions/string-functions.hash b/examples/string-functions/string-functions.hash index 8ab57f4..e720ebb 100644 --- a/examples/string-functions/string-functions.hash +++ b/examples/string-functions/string-functions.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +818faf1a5caccb1628010427eff861edd8379de8 +UeDwSoYepQt diff --git a/examples/structs/structs.hash b/examples/structs/structs.hash index 8ab57f4..f0189fa 100644 --- a/examples/structs/structs.hash +++ b/examples/structs/structs.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +995a3c5dec1de68fe79d5d3172531fb5d2b99870 +sJZCI3Gm3Ht diff --git a/examples/temporary-files-and-directories/temporary-files-and-directories.hash b/examples/temporary-files-and-directories/temporary-files-and-directories.hash index 8ab57f4..e68654d 100644 --- a/examples/temporary-files-and-directories/temporary-files-and-directories.hash +++ b/examples/temporary-files-and-directories/temporary-files-and-directories.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +99866fef55916b593bf73df9591ca9d7d2c86d7e +PMJP7pf-n5h diff --git a/examples/testing/testing.hash b/examples/testing/testing.hash index 8ab57f4..3f809e1 100644 --- a/examples/testing/testing.hash +++ b/examples/testing/testing.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +1a41d8c725f8bfe62838744d6327404ec1ddc319 +gZXCCqO7ezT diff --git a/examples/tickers/tickers.hash b/examples/tickers/tickers.hash index 8ab57f4..b4fefad 100644 --- a/examples/tickers/tickers.hash +++ b/examples/tickers/tickers.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +64772226ab38092e29f23802c8138a723e23cc83 +2bpsxisGGLj diff --git a/examples/time-formatting-parsing/time-formatting-parsing.hash b/examples/time-formatting-parsing/time-formatting-parsing.hash index 8ab57f4..892e30e 100644 --- a/examples/time-formatting-parsing/time-formatting-parsing.hash +++ b/examples/time-formatting-parsing/time-formatting-parsing.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +7a8299db21f9554a2b43ecece2d8abf7a370189c +G61ruGfMQZA diff --git a/examples/time/time.hash b/examples/time/time.hash index 8ab57f4..15db181 100644 --- a/examples/time/time.hash +++ b/examples/time/time.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +e532cf20c51b0106aba8c041ec44480f7690da5e +ZE4n1Jt55m0 diff --git a/examples/timeouts/timeouts.hash b/examples/timeouts/timeouts.hash index 8ab57f4..91d44dc 100644 --- a/examples/timeouts/timeouts.hash +++ b/examples/timeouts/timeouts.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +441dc07d57c03df070488f85dbe24e5ef6591bf7 +SCMyPsGlXtX diff --git a/examples/timers/timers.hash b/examples/timers/timers.hash index 8ab57f4..87c1ff7 100644 --- a/examples/timers/timers.hash +++ b/examples/timers/timers.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +d1689f059a29e7e0d3f9ccd52632220d487d6ca0 +7RnBhz_kuki diff --git a/examples/url-parsing/url-parsing.hash b/examples/url-parsing/url-parsing.hash index 77021f1..28c5bcd 100644 --- a/examples/url-parsing/url-parsing.hash +++ b/examples/url-parsing/url-parsing.hash @@ -1,2 +1,2 @@ -babc12f5066652f4cb0151231c06f1037298ff28 -M218D9Tldlr +f0b0a50b3471f972b26e6fefb481730661aac6e1 +Zt1KHMGZESo diff --git a/examples/values/values.hash b/examples/values/values.hash index 8ab57f4..3716621 100644 --- a/examples/values/values.hash +++ b/examples/values/values.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +1c4cf252844f42861e8fbc59a604833d0dbd24c0 +SYLIv-rApFj diff --git a/examples/variables/variables.hash b/examples/variables/variables.hash index 8ab57f4..76bfeee 100644 --- a/examples/variables/variables.hash +++ b/examples/variables/variables.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +e5f981f078207ac4f67b26be87a73c2989006685 +BUbDhWP8PV_k diff --git a/examples/variadic-functions/variadic-functions.hash b/examples/variadic-functions/variadic-functions.hash index 8ab57f4..46c87a0 100644 --- a/examples/variadic-functions/variadic-functions.hash +++ b/examples/variadic-functions/variadic-functions.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +e32d27f8b78c3e3f24c5dd98f864ffdb9567d628 +dz6tVXvffuH diff --git a/examples/worker-pools/worker-pools.hash b/examples/worker-pools/worker-pools.hash index 8ab57f4..fc92632 100644 --- a/examples/worker-pools/worker-pools.hash +++ b/examples/worker-pools/worker-pools.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +a719d863a0b07434beade5c6582eff76df8bd2ef +79qTVPHnwGQ diff --git a/examples/writing-files/writing-files.hash b/examples/writing-files/writing-files.hash index 8ab57f4..89cec11 100644 --- a/examples/writing-files/writing-files.hash +++ b/examples/writing-files/writing-files.hash @@ -1,2 +1,2 @@ -da39a3ee5e6b4b0d3255bfef95601890afd80709 -UCPdVNrl0-P +f6c74f9903720805417ffe5765cef04e3f58d966 +LscGbwmQZns diff --git a/public/arrays b/public/arrays index d19bf1c..caf712a 100644 --- a/public/arrays +++ b/public/arrays @@ -23,6 +23,179 @@
+ Обратите внимание, что массивы отображаются в виде +[v1 v2 v3 …] при выводе с помощью fmt.Println. + + |
+
+
+ $ go run arrays.go
+emp: [0 0 0 0 0]
+set: [0 0 0 0 100]
+get: 100
+len: 5
+dcl: [1 2 3 4 5]
+2d: [[0 1 2] [1 2 3]]
+ |
+
+ В Go вы будете встречать срезы гораздо чаще, чем +массивы. Срезы рассмотрим далее + + |
+ + + + | +
Следующий пример: Срезы (Slices). @@ -34,7 +207,7 @@
- Следующий пример: Чтение файлов (Reading Files). -
- - -diff --git a/public/atomic-counters b/public/atomic-counters index e073b4b..d3775c0 100644 --- a/public/atomic-counters +++ b/public/atomic-counters @@ -23,6 +23,206 @@
+ Основным механизмом управления состоянием в Go является
+связь по каналам. Мы видели это, например, с пулами воркеров.
+Есть несколько других вариантов управления состоянием.
+Здесь мы рассмотрим использование пакета |
+ + + + | +
+ + | +
+ ![]() ![]() package main
+ |
+
+ + | +
+
+ import (
+ "fmt"
+ "sync"
+ "sync/atomic"
+)
+ |
+
+ + | +
+
+ func main() {
+ |
+
+ Мы будем использовать целое число без знака +для представления нашего (всегда положительного) +счетчика. + + |
+
+
+ var ops uint64
+ |
+
+ WaitGroup поможет нам подождать, пока все горутины +завершат свою работу. + + |
+
+
+ var wg sync.WaitGroup
+ |
+
+ Мы запустим 50 горутин, каждая из которых увеличивает +счетчик ровно в 1000 раз. + + |
+
+
+ for i := 0; i < 50; i++ {
+ wg.Add(1)
+ |
+
+ Для атомарного увеличения счетчика мы
+используем AddUint64, присваивая ему адрес
+памяти нашего счетчика |
+
+
+ go func() {
+ for c := 0; c < 1000; c++ {
+ |
+
+ + | +
+
+ atomic.AddUint64(&ops, 1)
+ }
+ wg.Done()
+ }()
+ }
+ |
+
+ Ждем пока завершатся горутины. + + |
+
+
+ wg.Wait()
+ |
+
+ Теперь доступ к |
+
+
+ fmt.Println("ops:", ops)
+}
+ |
+
+ Мы ожидаем получить ровно 50 000 операций. Если бы
+мы использовали неатомарный |
+
+
+ $ go run atomic-counters.go
+ops: 50000
+ |
+
+ Далее мы рассмотрим мьютексы, еще один способ +управления состоянием. + + |
+ + + + | +
Следующий пример: Мьютексы (Mutexes). @@ -34,7 +234,7 @@
diff --git a/public/base64 b/public/base64 deleted file mode 100644 index eadbd1c..0000000 --- a/public/base64 +++ /dev/null @@ -1,41 +0,0 @@ - - -
- -
- - - -
-