A place to keep my go examples.
Table of Contents
- ARCHITECTURES
- BLOCKCHAIN
- SCRAPING
- CGO
- C CODE
- CLIENT/SERVER
- gRPC
- HTTP
- TCP/IP
- CLOUD SERVICE PROVIDERS
- GOOGLE CLOUD PLATFORM
- MICROSOFT AZURE
- COMMON GO
- ERROR REPORTING
- FLAGS
- LOGGING
- MY GENERIC GO TEMPLATE
- TESTING
- CRYPTOGRAPHY
- ASYMMETRIC CRYPTOGRAPHY
- HASHING
- SYMMETRIC CRYPTOGRAPHY
- DATABASES
- NON-RELATIONAL
- RELATIONAL
- FUNCTIONS, METHODS AND INTERFACES
- FUNCTIONS
- METHODS
- INTERFACES
- GO RUNTIME
- GOROUTINES
- INTERACT GO RUNTIME
- INTERACT HOST OS
- INPUT/OUTPUT
- IO READER
- IO WRITER
- IN-PROCESS COMMUNICATION
- SHARED MEMORY
- MESSAGE PASSING
- INTER-PROCESS COMMUNICATION (IPC)
- SHARED MEMORY
- MESSAGE PASSING
- IoT
- RASPBERRY PI
- MODULES AND PACKAGES
- LOCAL PACKAGES
- REMOTE PACKAGES
- STANDARD GO PACKAGES
Documentation and Reference
- go
- go standard library
- my-go-packages
- my-go-tools
- This repos github webpage built with concourse
-
BLOCKCHAIN
-
Demonstrates a bitcoin ledger in a blockchain using the unspent transaction output model.
-
create-bitcoin-address-from-ecdsa-publickey
Create a bitcoin address from your ecdsa public key using the crypto/ecdsa standard package.
-
single-node-blockchain-with-REST
A simple single node sha256 blockchain with a REST JSON API (to view (GET) the blockchain and add (POST) a block).
-
-
WEB SCRAPING
- [web scrape twitter for ???]
-
C CODE
-
A very simple example to show you how to write a c function in go.
-
A c function in go using stdio.h for printf.
-
-
gRPC
- Coming soon.
-
HTTP
- Coming soon.
-
TCP/IP
- Coming soon.
-
GOOGLE CLOUD PLATFORM
- Coming soon.
-
MICROSOFT AZURE
- Coming soon.
-
ERROR REPORTING
Error Handling using the standard errors standard package.
-
FLAGS
-
LOGGING
-
Logging using my github.com/JeffDeCola/my-go-packages/golang/logger which uses the standard structured logging log/slog standard package.
-
-
MY GENERIC GO TEMPLATE
-
A simple go template with flags, logging & error handling.
-
-
TESTING
- Coming soon.
-
ASYMMETRIC CRYPTOGRAPHY (Great for digital signatures (verify sender) and receiving encrypted data)
- Coming soon.
-
HASHING (Great for getting fingerprints)
- Coming soon.
-
SYMMETRIC CRYPTOGRAPHY (Using the same key to encrypt and decrypt)
- Coming soon.
-
NON-RELATIONAL
- Coming soon.
-
RELATIONAL
- Coming soon.
-
FUNCTIONS
-
Using functions to calculate the area of a rectangle and circle.
-
Using functions to calculate the area of a rectangle and circle by passing pointers.
-
-
METHODS
-
Using methods to calculate the area of a rectangle and circle.
-
Using methods to calculate the area of a rectangle and circle by passing pointers.
-
Using methods to calculate the area of a rectangle and circle by passing pointers and using pointer receivers.
-
-
INTERFACES
-
Using an interface to calculate the area of a rectangle and circle.
-
Using an interface to calculate the area of a rectangle and circle by passing pointers.
-
Using an interface to calculate the area of a rectangle and circle by passing pointers and using pointer receivers.
-
Using an interface to calculate and manipulate simple 2D and 3D geometric shapes.
-
-
GO ROUTINES
-
Concurrency across multiples cores. You can play around with workers, threads, cpus/cores and nice to find the fastest performance. It will find the total number of prime numbers within a range. Lightweight goroutines are amazing.
-
Concurrency using a waitgroup (waiting for a collection of goroutines to finish).
-
Concurrency using worker pools.
-
-
INTERACT GO RUNTIME
-
simple-go-runtime-interactions
A few go runtime interactions using the runtime standard package.
-
-
INTERACT HOST OS
-
IO READER
-
Read data (a stream of bytes) from a string, buffer, file, stdin and a pipe to a buffer using the io standard package.
-
Read data (a stream of bytes) from a buffer to a buffer using the io standard package.
-
Read a file (*os.File) to a buffer.
-
Read user input (os.Stdin) to a buffer (using Read method) and string (using Fscan).
-
-
IO WRITER
-
SHARED MEMORY
-
ASYNCHRONOUS
- Coming soon.
-
SYNCHRONOUS
-
A pipe provides a uni-directional communication channel. This is a very simple example of an unnamed pipe.
-
This is a more robust example of an unnamed pipe showing multiple reads.
-
This example of an unnamed pipe connects an io.Writer and io.Reader.
-
-
-
MESSAGE PASSING
-
ASYNCHRONOUS
-
Buffered channels are uni-directional, asynchronous with no blocking.
-
-
SYNCHRONOUS
-
Unbuffered channels are uni-directional, synchronous with blocking.
-
-
-
SHARED MEMORY
-
ASYNCHRONOUS
- Coming soon.
-
SYNCHRONOUS
-
Sending data over a named-pipe (FIFO) from one process to another process.
-
-
-
MESSAGE PASSING
-
OPERATING SYSTEM
-
ASYNCHRONOUS
-
tbd.
-
tbd.
-
tbd.
-
-
SYNCHRONOUS
-
tbd.
-
-
-
NETWORK
-
ASYNCHRONOUS
-
tbd.
-
tbd.
-
-
SYNCHRONOUS
-
tbd.
-
tbd.
-
-
-
-
RASPBERRY PI
-
blink-led-raspberry-pi-gpio-periph
GPIO OUTPUT - Blink an LED via a Raspberry Pi GPIO using the periph.io/... packages.
-
push-button-raspberry-pi-gpio-periph
GPIO INPUT - Push a button via a Raspberry Pi GPIO using the periph.io/... packages.
-
toggle-led-with-button-raspberry-pi-gpio-periph
Toggle an LED with a button push via a Raspberry Pi GPIO using the periph.io/... packages.
-
-
LOCAL PACKAGES
-
A go module with a local package.
-
-
REMOTE PACKAGES
-
A go module with a remote (public) package.
-
- archive
- tar
- zip
- bufio
- bytes
- cmp
- compress
- bzip2
- flate
- gzip
- lzw
- zlib
- container
- heap
- list
- ring
- context
- crypto
- aes - encryptfile tool, decryptfile tool
- ecdsa - create-bitcoin-address-from-ecdsa-publickey
- elliptic - create-bitcoin-address-from-ecdsa-publickey
- md5 - md5-hash-file tool
- rand - create-bitcoin-address-from-ecdsa-publickey
- sha256 - create-bitcoin-address-from-ecdsa-publickey, sha256-hash-file tool
- x509 - create-bitcoin-address-from-ecdsa-publickey
- etc...
- database
- sql
- sql-driver
- debug
- buildinfo
- dwarf
- etc...
- embed
- encoding
- errors - error-example
- expvar
- flag - flags
- fmt
- go
- ast
- build
- etc...
- hash
- adler32
- crc32
- crc64
- fnv
- maphash
- html
- template
- image
- color
- color/palette
- draw
- gif
- jpeg
- png
- index
- suffixarray
- io -
io-reader,
io-reader-simple,
io-writer,
io-writer-simple
- fs
- ioutil
- iter
- log
- slog - jeffs-logger
- syslog
- maps
- math
- big
- bits
- cmplx
- rand
- rand/v2
- mime
- multipart
- quotedprintable
- net
- http
- http/cgi
- etc.,,
- os
- exec - simple-external-commands
- signal
- user
- path
- filepath
- reflect - create-bitcoin-address-from-ecdsa-publickey
- regexp (syntax)
- runtime -
simple-go-runtime-interactions
- cgo
- coverage
- etc...
- slices
- sort
- strconv
- strings
- structs
- sync (atomic)
- syscall -
simple-os-interactions
- js
- testing
- fstest
- iotest
- quick
- slogtest
- synctest
- text
- scanner
- tabwriter
- template
- template/parse
- time
- tzdata
- unicode
- utf1
- utf8
- unique
- unsafe
- weak