478 Commits

Author SHA1 Message Date
Eli Bendersky
fc88db1814 Fix up embed-directive example and rename files to be shorter 2022-05-24 06:11:22 -07:00
peterzhu1992
7e4533640b
Add embed-directive example (#423)
* Add embed-directive example and rename embedding to struct-embedding

Signed-off-by: peterzhu1992 <peterzhu1992@gmail.com>

* Minor tweaks

Signed-off-by: peterzhu1992 <peterzhu1992@gmail.com>

* Add some improvements

Signed-off-by: peterzhu1992 <peterzhu1992@gmail.com>

* Add isDir() checks for measure.go and generate.go in tools

Signed-off-by: peterzhu1992 <peterzhu1992@gmail.com>
2022-05-24 05:31:13 -07:00
peterzhu1992
a19c5b87e6
Rename embedding to struct embedding to be separated from //go:embed directive (#424)
Signed-off-by: peterzhu1992 <peterzhu1992@gmail.com>
2022-05-17 10:59:35 -07:00
Eli Bendersky
9deadb76ae Improve spawning-process example with error-checking 2022-05-06 10:16:02 -07:00
Eli Bendersky
6b91c38bb3 Rebuild embedding example and publish public/
Closes #420
2022-05-02 10:30:17 -07:00
Eli Bendersky
e6c5a8fb2f Fix typo in embedding example's comment
Based on #420 by @smottt
2022-05-02 10:29:44 -07:00
Eli Bendersky
ed7a093662 Clean up description in SHA256 example 2022-03-31 05:45:19 -07:00
Hayden B
ac01d2d4bb
Update SHA1 example to SHA256 (#418)
This encourages the use of stronger cryptographic hashes. Tools such as
securego/gosec will show errors when SHA1/MD5 hashes are used.
2022-03-31 05:41:58 -07:00
Eli Bendersky
881bb5d41c Remove collection-functions
Now that we have generics, this example is not relevant.

Updates #349
2022-03-15 10:56:14 -07:00
Eli Bendersky
3c2447b2d1
Add example of Go generics (#415)
* Add example of Go generics

Fixes #349

* Remove TODO

* Update public link

* Update GitHub action to only build with 1.18-rc1

1.17 won't successfully build the generics example
2022-03-15 10:53:49 -07:00
Eli Bendersky
0751f43b3a Round of fixes for the new text-template example
Making it a bit cleaner and easier to understand
2022-02-10 13:54:06 -08:00
Arash Sameni
ccfd710f2b
Templates: added comments, output and listed in examples (#413) 2022-02-10 12:46:38 -08:00
Eli Bendersky
5fa0d40cdb Re-generate output after #414 2022-02-10 05:27:34 -08:00
Konstantin Kovshenin
0f801fd5f3
Fix typo in strings-and-runes (#414) 2022-02-10 05:25:18 -08:00
Eli Bendersky
2c7b384669 Clean up last printout in string-functions
It's unnecessary now
2022-02-05 07:22:56 -08:00
Eli Bendersky
e604254e38 Tweaks to other samples to accommodate strings-and-runes
Add a link to the range sample, and remove partial mentions of this
topic in string-functions since it's now covered well in
strings-and-runes
2022-02-05 07:11:37 -08:00
Eli Bendersky
b2057ccfd2 strings-and-runes: added comments, output and listed in examples 2022-02-05 07:08:26 -08:00
Eli Bendersky
ff399c7001 Starting a strings-runes example
For now just the code, no output, no comments

For #411
2022-02-04 16:49:44 -08:00
Eli Bendersky
2885fc2298 Move around commend in recursion sample for better rendering
This way the commend renders next to the right code block
2022-01-28 09:26:30 -08:00
Eli Bendersky
63ed62348e Slight comment rewording following the previous commit 2022-01-10 05:45:35 -08:00
Sandeep
1c7180a00f
Update Epoch example to add UnixMilli from Time package (#409)
Standard library time package has support for UnixMilli - https://pkg.go.dev/time#Time.UnixMilli
Updated the example to use the method on Time instead of calculating.
2022-01-10 05:42:31 -08:00
Eli Bendersky
061b2f6455 Rename testing --> testing-and-benchmarking 2021-12-02 07:12:23 -08:00
Eli Bendersky
99902be3b2 Slightly tweak comments after #403 2021-12-02 07:09:23 -08:00
Johanan Idicula
dadb6bdeae
feat: Add benchmark example (#403)
* feat: Add benchmark example

Adds a simple benchmark example and its invocation.

* fix: Address PR comments

- Clarify meaning of `b.N`.
- Nix verbose flag in run example.

* fix: Reword b.N comment

* fix: Missing period
2021-12-02 07:04:59 -08:00
Eli Bendersky
80fb5ebddf Clarify the signals example slightly
Based on feedback in #402
2021-12-02 06:31:37 -08:00
Eli Bendersky
c93e7c1cf8 Generate public/* for mutex 2021-11-22 12:53:10 -08:00
Nate Finch
2621c73d29
don't embed the mutex (#400)
Do not embed the mutex in the mutex example
2021-11-22 12:51:49 -08:00
Eli Bendersky
35ad9cc35c Add example of struct embedding in Go
Also mention implementing interfaces with embedding

Fixes #381
Fixes #398
2021-11-22 12:48:11 -08:00
Eli Bendersky
f09cadcbd9 Change mutexes example to make it simpler and more predictable
Fixes #364
2021-10-30 06:20:02 -07:00
Eli Bendersky
e10011f90f Rebuild example to public after previous PR's change 2021-09-20 06:38:52 -07:00
Gautam Kotian
15c92ee528
Minor fixes (#396)
* Add missing word

* Rename `boolPtr` to `forkPtr`

This is in order to be consistent with the other flags `wordPtr` &
`numbPtr` which are based on the name of the flag and not the type of
the flag.
2021-09-20 06:37:55 -07:00
Eli Bendersky
eac6776159 Clarify comment
Remove an ambiguous part of the comment that can cause confusion -
passing a WaitGroup by pointer is always mandatory.
2021-09-10 07:19:33 -07:00
Eli Bendersky
b1ef499821 Rewrite the WaitGroup example to be more idiomatic
A wrapper closure invokes wg.Done

Still mention the pass-by-pointer requirements on the WaitGroup

Fixes #278
2021-09-10 06:11:56 -07:00
Eli Bendersky
4de485a514 Add partial prefixes in some places to regular-expressions
See #394 for details.

This closes #288 by providing a lighter-weight approach.
2021-09-10 05:56:40 -07:00
Eli Bendersky
cf0d050e81 Rename some string formatting outputs
Also rebuild output
2021-09-08 05:46:23 -07:00
V. K
33985af4da
Added prefixes with purpose to find output result easier. (#391) 2021-09-08 05:42:31 -07:00
Eli Bendersky
2e6a5ad8c9 Clarify the comment on the recursion example
More than one example in it now
2021-09-02 10:40:04 -07:00
Eli Bendersky
d037acd3e6 Update Recursion example to demonstrate recursive closures
Fixes #389
2021-09-02 05:53:30 -07:00
Eli Bendersky
2acace92c0 Clarify the panic example with a comment about unreachable code
Fixes #390
2021-09-02 05:42:07 -07:00
Eli Bendersky
91c8ceec2c Adding a new example: recover
With thanks to @LaryBattle for the discussion in #46 and
@kilaka for the discussion in #344.

Fixes #46
Closes #344
2021-09-01 08:51:00 -07:00
Eli Bendersky
69efd4b8c0 Add note to waitgroups example about errgroup
Fixes #308
2021-08-30 09:18:16 -07:00
Eli Bendersky
df8a378a22 Remove outdated link from an example
gobyexample doesn't use pygments anymore, so the generate program doesn't
spawn anything.
2021-08-30 07:24:48 -07:00
Eli Bendersky
a9507f5bbb
Clarify comment for the goroutines sample (#366)
* Clarify comment for the goroutines sample.

The current comment may be interpreted to say that the output must be
interleaved, when in fact it doesn't have to be (it depends on the order
the goroutines are run). Make the comment more permissive to avoid the
confusion.

Fixes #365

* Fix phrasing in comment
2021-08-30 07:17:25 -07:00
Eli Bendersky
ac94809b64
Replace deprecated ioutil functions with others (#374)
* Remove use of deprecated ioutil functions from examples

* Remove usage of ioutil from gobyexample's own scripts

+ regenerate output
2021-08-28 06:38:35 -07:00
Eli Bendersky
81ab859a7b
Upgrade blackfriday to v2 and fix underscore italics (#350)
Now that we have a go.mod, we can properly upgrade to blackfriday/v2

The output remains the same, but this PR brings back italic links with '_',
placing them into the link since this seems to be the more proper way.

Fixes #182
2021-02-20 10:22:23 -08:00
Mark McGranaghan
fff24f8bc7 Rebuild for typo fix 2021-02-19 13:17:41 -08:00
Yuri
1ecc5bfc61 Fix a typo 2021-02-19 13:16:37 -08:00
Mark McGranaghan
f72f11e641 Rebuild 2020-10-19 08:04:08 -07:00
legonian
71719ea0f3
Change t.Fail to t.Fatal
Fail* continues execution, right function probably Fatal*.
2020-10-18 14:34:13 +03:00
Mark McGranaghan
7d87b1b9f0 Rebuild 2020-08-23 07:50:27 -07:00