forked from mmcgrana/gobyexample
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
227 changed files
with
2,236 additions
and
2,182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,78 @@ | ||
# Go by Example | ||
# Go за прикладом [![Build Status](https://travis-ci.org/butuzov/gobyexample.svg?branch=ukrainian)](https://travis-ci.org/butuzov/gobyexample) | ||
|
||
Content and build toolchain for [Go by Example](https://gobyexample.com), | ||
a site that teaches Go via annotated example programs. | ||
|
||
### Overview | ||
Наповнення та інструментарій для [Go за Прикладом](https://butuzov.github.io/gobyexample/), сайту що навчає Go за допомогою анотованих прикладів. | ||
|
||
The Go by Example site is built by extracting code and | ||
comments from source files in `examples` and rendering | ||
them using `templates` into a static `public` | ||
directory. The programs implementing this build process | ||
are in `tools`, along with dependencies specified in | ||
the `go.mod`file. | ||
### Загальне | ||
|
||
The built `public` directory can be served by any | ||
static content system. The production site uses S3 and | ||
CloudFront, for example. | ||
Сайт "Go за прикладом" збудовано шляхом обробки коду та коментарів отриманих з першоджерельних файлів (що знаходяться в директорії `examples`) та форматуванню їх за допомогою шаблонів (з директорій `templates`) у статичні файли (що лежатимуть у директорії `public`). Інструменти що забезпечують весь процес створення сайт знаходяться у директорії `tools`, поряд з деякими залежностями (що лежать у `vendor`). | ||
|
||
### Building | ||
|
||
[![test](https://github.com/mmcgrana/gobyexample/actions/workflows/test.yml/badge.svg)](https://github.com/mmcgrana/gobyexample/actions/workflows/test.yml) | ||
Створена директорія `public` може буде завантажена на будь-який shared/CDN/cloud хостинг. | ||
|
||
To build the site you'll need Go installed. Run: | ||
### Побудова сайту | ||
|
||
[![test](https://github.com/butuzov/gobyexample/actions/workflows/test.yml/badge.svg)](https://github.com/butuzov/gobyexample/actions/workflows/test.yml) | ||
|
||
Щоб побудувати цей сайт вам потрібно буде Go. Запустіть: | ||
|
||
```console | ||
$ tools/build | ||
``` | ||
|
||
To build continuously in a loop: | ||
Будувати в циклі: | ||
|
||
```console | ||
$ tools/build-loop | ||
``` | ||
|
||
To see the site locally: | ||
Обслуговувати сайт локально: | ||
|
||
``` | ||
$ tools/serve | ||
``` | ||
|
||
and open `http://127.0.0.1:8000/` in your browser. | ||
На відкрийте `http://127.0.0.1:8000/` у вашому браузері | ||
|
||
### Зауваження щодо `public` | ||
|
||
Ця директорія не оновлються в українській версії репозиторію. Перегенеруйте файли власноруч, у разі потреби. | ||
|
||
|
||
### Publishing | ||
|
||
To upload the site: | ||
Щоб завантажити сайт на AWS: | ||
|
||
```console | ||
$ export AWS_ACCESS_KEY_ID=... | ||
$ export AWS_SECRET_ACCESS_KEY=... | ||
$ tools/upload | ||
```bash | ||
> gem install aws-sdk | ||
> export AWS_ACCESS_KEY_ID=... | ||
> export AWS_SECRET_ACCESS_KEY=... | ||
> tools/upload | ||
``` | ||
|
||
### License | ||
### Ліцензія | ||
|
||
This work is copyright Mark McGranaghan and licensed under a | ||
Ця робота є авторським правом Mark McGranaghan та ліцензована за | ||
[Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/). | ||
|
||
The Go Gopher is copyright [Renée French](https://reneefrench.blogspot.com/) and licensed under a | ||
Go's Гофер є авторським правом [Renée French](http://reneefrench.blogspot.com/) та ліцензовано за | ||
[Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/). | ||
|
||
### Інші переклади | ||
|
||
### Translations | ||
|
||
Contributor translations of the Go by Example site are available in: | ||
Переклади "Go by Example" від волонтерів доступні в наступних версіях: | ||
|
||
* [Brazilian Portuguese](https://lcslitx.github.io/GoEmExemplos/) by [lcslitx](https://github.com/LCSLITX) | ||
* [Chinese](https://gobyexample-cn.github.io/) by [gobyexample-cn](https://github.com/gobyexample-cn) | ||
* [Czech](http://gobyexamples.sweb.cz/) by [martinkunc](https://github.com/martinkunc/gobyexample-cz) | ||
* [French](http://le-go-par-l-exemple.keiruaprod.fr) by [keirua](https://github.com/keirua/gobyexample) | ||
* [Italian](https://gobyexample.it) by the [Go Italian community](https://github.com/golangit/gobyexample-it) | ||
* [Japanese](http://spinute.org/go-by-example) by [spinute](https://github.com/spinute) | ||
* [Korean](https://mingrammer.com/gobyexample/) by [mingrammer](https://github.com/mingrammer) | ||
* [Russian](https://gobyexample.com.ru/) by [badkaktus](https://github.com/badkaktus) | ||
* [Ukrainian](https://butuzov.github.io/gobyexample/) by [butuzov](https://github.com/butuzov/gobyexample) | ||
* [Brazilian Portuguese](https://lcslitx.github.io/GoEmExemplos/) by [lcslitx](https://github.com/LCSLITX) | ||
* [Ukrainian](http://butuzov.github.io/gobyexample/) by [butuzov](https://github.com/butuzov/gobyexample) | ||
* [Vietnamese](https://gobyexample.vn/) by [s6k Gopher](https://github.com/s6k-gopher/gobyexample-vn) | ||
|
||
### Thanks | ||
|
||
Thanks to [Jeremy Ashkenas](https://github.com/jashkenas) | ||
for [Docco](http://jashkenas.github.io/docco/), which | ||
inspired this project. | ||
|
||
### FAQ | ||
|
||
#### I found a problem with the examples; what do I do? | ||
|
||
We're very happy to fix problem reports and accept contributions! Please submit | ||
[an issue](https://github.com/mmcgrana/gobyexample/issues) or send a Pull Request. | ||
See `CONTRIBUTING.md` for more details. | ||
|
||
#### What version of Go is required to run these examples? | ||
|
||
Given Go's strong [backwards compatibility guarantees](https://go.dev/doc/go1compat), | ||
we expect the vast majority of examples to work on the latest released version of Go | ||
as well as many older releases going back years. | ||
|
||
That said, some examples show off new features added in recent releases; therefore, | ||
it's recommended to try running examples with the latest officially released Go version | ||
(see Go's [release history](https://go.dev/doc/devel/release) for details). | ||
|
||
#### I'm getting output in a different order from the example. Is the example wrong? | ||
|
||
Some of the examples demonstrate concurrent code which has a non-deterministic | ||
execution order. It depends on how the Go runtime schedules its goroutines and | ||
may vary by operating system, CPU architecture, or even Go version. | ||
|
||
Similarly, examples that iterate over maps may produce items in a different order | ||
from what you're getting on your machine. This is because the order of iteration | ||
over maps in Go is [not specified and is not guaranteed to be the same from one | ||
iteration to the next](https://go.dev/ref/spec#RangeClause). | ||
|
||
It doesn't mean anything is wrong with the example. Typically the code in these | ||
examples will be insensitive to the actual order of the output; if the code is | ||
sensitive to the order - that's probably a bug - so feel free to report it. | ||
|
||
|
||
|
||
### Дякуємо | ||
|
||
Дякуюємо [Jeremy Ashkenas](https://github.com/jashkenas) | ||
за [Docco](http://jashkenas.github.com/docco/), що надихнули на цей проект. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# https://taskfile.dev | ||
|
||
version: '3' | ||
|
||
vars: | ||
GREETING: Hello, World! | ||
|
||
tasks: | ||
default: | ||
sources: | ||
- ./examples/**/*.go | ||
- ./examples/**/*.sh | ||
- ./templates/*.* | ||
- ./examples.txt | ||
method: timestamp | ||
cmds: | ||
- cmd: ./tools/build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,81 @@ | ||
Hello World | ||
Values | ||
Variables | ||
Constants | ||
For | ||
If/Else | ||
Switch | ||
Arrays | ||
Slices | ||
Maps | ||
Range | ||
Functions | ||
Multiple Return Values | ||
Variadic Functions | ||
Closures | ||
Recursion | ||
Pointers | ||
Strings and Runes | ||
Structs | ||
Methods | ||
Interfaces | ||
Struct Embedding | ||
Generics | ||
Errors | ||
Goroutines | ||
Channels | ||
Channel Buffering | ||
Channel Synchronization | ||
Channel Directions | ||
Привіт Світе|Hello World | ||
Значення|Values | ||
Змінні|Variables | ||
Константи|Constants | ||
Цикли|For | ||
Оператори Розгалуження (If/Else)|If/Else | ||
Оператори Розгалуження (Switch)|Switch | ||
Масиви|Arrays | ||
Зрізи|Slices | ||
Мапи|Maps | ||
Діапазон|Range | ||
Функції|Functions | ||
Поверненння Кількох Значень|Multiple Return Values | ||
Варіативні Функції|Variadic Functions | ||
Замикання|Closures | ||
Рекурсія|Recursion | ||
Вказівники|Pointers | ||
Рядки та руни|Strings and Runes | ||
Структури|Structs | ||
Методи|Methods | ||
Інтерфейси (Interfaces)|Interfaces | ||
Вбудовування структур|Struct Embedding | ||
Дженерики|Generics | ||
Помилки (Errors)|Errors | ||
Горутини (Goroutines)|Goroutines | ||
Канали|Channels | ||
Буферизація каналiв|Channel Buffering | ||
Синхронізація каналу|Channel Synchronization | ||
Напрямки каналу|Channel Directions | ||
Select | ||
Timeouts | ||
Non-Blocking Channel Operations | ||
Closing Channels | ||
Range over Channels | ||
Timers | ||
Tickers | ||
Тайм-аути (Timeouts)|Timeouts | ||
Не Блокуючі Операції на Каналах|Non-Blocking Channel Operations | ||
Закриття каналів|Closing Channels | ||
Діапазон (Range) з Каналами|Range over Channels | ||
Хронометри (Timers)|Timers | ||
Маятники (Tickers)|Tickers | ||
Worker Pools | ||
WaitGroups | ||
Rate Limiting | ||
Atomic Counters | ||
Mutexes | ||
Групи Очікування (WaitGroups)|WaitGroups | ||
Обмеження Частоти Запитів|Rate Limiting | ||
Атомарні Лічильники|Atomic Counters | ||
Взаємні Виключення (Mutexes)|Mutexes | ||
Stateful Goroutines | ||
Sorting | ||
Sorting by Functions | ||
Panic | ||
Defer | ||
Recover | ||
String Functions | ||
String Formatting | ||
Text Templates | ||
Regular Expressions | ||
Сортування|Sorting | ||
Сортування функціями|Sorting by Functions | ||
Паніка|Panic | ||
Відкладення|Defer | ||
Відновлення|Recover | ||
Рядкові Функції|String Functions | ||
Форматування Рядків|String Formatting | ||
Текстові Шаблони|Text Templates | ||
Регулярні Вирази|Regular Expressions | ||
JSON | ||
XML | ||
Time | ||
Час|Time | ||
Epoch | ||
Time Formatting / Parsing | ||
Random Numbers | ||
Number Parsing | ||
URL Parsing | ||
SHA256 Hashes | ||
Base64 Encoding | ||
Reading Files | ||
Writing Files | ||
Line Filters | ||
File Paths | ||
Directories | ||
Temporary Files and Directories | ||
Форматування та Розбір Часу|Time Formatting / Parsing | ||
Генерація випадкових чисел|Random Numbers | ||
Конвертація Тексту в Числа|Number Parsing | ||
Розбір URL|URL Parsing | ||
SHA256 Хеші|SHA256 Hashes | ||
Кодування Base64|Base64 Encoding | ||
Читання файлів|Reading Files | ||
Запис файлів|Writing Files | ||
Рядкові Фільтри|Line Filters | ||
Файлові Шляхи|File Paths | ||
Директорії|Directories | ||
Тимчасові Файли та Директорії|Temporary Files and Directories | ||
Embed Directive | ||
Testing and Benchmarking | ||
Command-Line Arguments | ||
Command-Line Flags | ||
Command-Line Subcommands | ||
Environment Variables | ||
Logging | ||
HTTP Client | ||
HTTP Server | ||
Context | ||
Spawning Processes | ||
Exec'ing Processes | ||
Signals | ||
Тестування та Вимірювання|Testing and Benchmarking | ||
Командний Рядок - Аргументи|Command-Line Arguments | ||
Командний Рядок - Перемикачі|Command-Line Flags | ||
Командний Рядок - Під Команди|Command-Line Subcommands | ||
Змінні середовища|Environment Variables | ||
Logging|Logging | ||
HTTP Клієнт|HTTP Client | ||
HTTP Сервер|HTTP Server | ||
Контекст|Context | ||
Запуск сторонніх процесів|Spawning Processes | ||
Заміна поточного процесу новим|Exec'ing Processes | ||
Сигнали|Signals | ||
Exit |
Oops, something went wrong.