code-for-blog

module
v0.0.0-...-0d2bfe8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2024 License: Unlicense

README

This repository collects code samples linked from `my blog
<https://eli.thegreenplace.net>`_. Unless otherwise noted, all the code here is
in the public domain (see the ``LICENSE`` file in this repository for more
details).

I'm making this code available publicly in good faith; note that this does not
mean the code is supported in any way. I'm unlikely to provide significant
support for code in old articles, for example, because sometimes I no longer
have the environment required to run and test the code.

Directories

Path Synopsis
2016
go-suffixarray/src command
Go suffixarray sample - basic usage of creation and lookup.
Go suffixarray sample - basic usage of creation and lookup.
2018
go-copying-mutex command
Pointer receiver properly referring to mutex.
Pointer receiver properly referring to mutex.
goadt command
Parser and evaluator for a simple calculator with variables.
Parser and evaluator for a simple calculator with variables.
threadoverhead command
Ping ponging messages between two goroutines on a channel, measuring number of messages sent per second.
Ping ponging messages between two goroutines on a channel, measuring number of messages sent per second.
2019
aes-encrypt-file command
Sample of encrypting and decrypting a buffer with crypto/aes.
Sample of encrypting and decrypting a buffer with crypto/aes.
github-hook-google-cloud-function
Simple payload server for Github hooks.
Simple payload server for Github hooks.
go-check-interface command
Basic example that demonstrates a type that doesn't implement an interface being flagged for a compile error when assigned to the interface.
Basic example that demonstrates a type that doesn't implement an interface being flagged for a compile error when assigned to the interface.
gohttpconcurrency command
This is a basic server that has race conditions.
This is a basic server that has race conditions.
gojsoncookbook command
Decoding arbitrary nested maps from JSON using generic interface{}s.
Decoding arbitrary nested maps from JSON using generic interface{}s.
loopvar-goroutine command
Closure capture of loop variables, forcing by-value capture with ii.
Closure capture of loop variables, forcing by-value capture with ii.
rwlocks command
Implementation of several read-write locks in Go.
Implementation of several read-write locks in Go.
xml-stream command
An example streaming XML parser using encoding/xml.
An example streaming XML parser using encoding/xml.
2020
go-json-complex-types command
Sample code for unmarshaling complex JSON structures into Go structs, using several approaches.
Sample code for unmarshaling complex JSON structures into Go structs, using several approaches.
go-json-optional-fields command
Custom unmarshaling of a JSON type to a map, in order to set defaults to missing keys.
Custom unmarshaling of a JSON type to a map, in order to set defaults to missing keys.
go-pubsub command
PubSub implementation where Subscribe returns a channel.
PubSub implementation where Subscribe returns a channel.
go-testing-flags command
Splitting flag parsing to a self contained function returning a Config.
Splitting flag parsing to a self contained function returning a Config.
tcp-server-shutdown/shutdown1
Socket server that can be shut down -- stop serving, in a graceful manner.
Socket server that can be shut down -- stop serving, in a graceful manner.
tcp-server-shutdown/shutdown2
Socket server that can be shut down -- stop serving, in a graceful manner.
Socket server that can be shut down -- stop serving, in a graceful manner.
2021
go-generic-slice command
Examples of writing concrete (non-generic) functions on slices.
Examples of writing concrete (non-generic) functions on slices.
go-life-http-request command
Basic server using the default mux.
Basic server using the default mux.
tls command
Simple HTTPS client in Go with mTLS.
Simple HTTPS client in Go with mTLS.
tlssocket command
TLS socket dialer, showing certificate chain of server.
TLS socket dialer, showing certificate chain of server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL