<commit_before># my-go-examples

[![Go Report Card](https://goreportcard.com/badge/github.com/JeffDeCola/my-go-examples)](https://goreportcard.com/report/github.com/JeffDeCola/my-go-examples)
[![GoDoc](https://godoc.org/github.com/JeffDeCola/my-go-examples?status.svg)](https://godoc.org/github.com/JeffDeCola/my-go-examples)
[![Maintainability](https://api.codeclimate.com/v1/badges/3c5477c63d77a071fdff/maintainability)](https://codeclimate.com/github/JeffDeCola/my-go-examples/maintainability)
[![Issue Count](https://codeclimate.com/github/JeffDeCola/my-go-examples/badges/issue_count.svg)](https://codeclimate.com/github/JeffDeCola/my-go-examples/issues)
[![License](http://img.shields.io/:license-mit-blue.svg)](http://jeffdecola.mit-license.org)

_A place to keep my go code snippets and examples._

These go examples also contain a lot of information
I gathered from other sources.

Table of Contents,

* [API](https://github.com/JeffDeCola/my-go-examples#api)
* [BASIC PROGRAMMING](https://github.com/JeffDeCola/my-go-examples#basic-programming)
* [BASIC SYNTAX](https://github.com/JeffDeCola/my-go-examples#basic-syntax)
  * Data Types
  * Functions
  * Interfaces
  * Methods
* [BLOCKCHAIN](https://github.com/JeffDeCola/my-go-examples#blockchain)
* [CGO](https://github.com/JeffDeCola/my-go-examples#cgo)
* [CLOUD SERVICES](https://github.com/JeffDeCola/my-go-examples#cloud-services)
* [CRYPTOGRAPHY](https://github.com/JeffDeCola/my-go-examples#cryptography)
  * ASYMMETRIC CRYPTOGRAPHY
  * HASHING
  * SYMMETRIC CRYPTOGRAPHY
* [DATABASE](https://github.com/JeffDeCola/my-go-examples#database)
* [GOROUTINES](https://github.com/JeffDeCola/my-go-examples#goroutines)
* [JEFFS GO TEMPLATES](https://github.com/JeffDeCola/my-go-examples#jeffs-go-templates)
* [MESSAGING](https://github.com/JeffDeCola/my-go-examples#messaging)
* [PACKAGES](https://github.com/JeffDeCola/my-go-examples#packages)
* [TESTING](https://github.com/JeffDeCola/my-go-examples#testing)
* [WEBSERVER](https://github.com/JeffDeCola/my-go-examples#webserver)

[GitHub Webpage](https://jeffdecola.github.io/my-go-examples/)

## GO EXAMPLES

_All sections in alphabetical order._

### API

* [http-GET-POST](https://github.com/JeffDeCola/my-go-examples/tree/master/api/http-GET-POST)

  _Using the standard `net/http` package to `http.Get` and `http.PostForm`._

* [OAuth-2.0-google-cloud-storage-api](https://github.com/JeffDeCola/my-go-examples/tree/master/api/OAuth-2.0-google-cloud-storage-api)
  _(Under construction - check back soon)_

  _Using OAuth 2.0 to access a users google cloud storage
  (based on scopes) via googles api._

* [OAuth-2.0-google-cloud-storage-api-over-NATS](https://github.com/JeffDeCola/my-go-examples/tree/master/api/OAuth-2.0-google-cloud-storage-api-over-NATS)
  _(Under construction - check back soon)_

  _Using OAuth 2.0 (frontend and backend via protobuf over NATS)
  to access a users google cloud storage (based on scopes) via googles api._

* [simple-tcp-ip-server](https://github.com/JeffDeCola/my-go-examples/tree/master/api/simple-tcp-ip-server)

  _Using the standard `net` package to build a simple tcp server
  to handle requests concurrently over ip (tcp/ip)._

* [simple-webserver-with-REST](https://github.com/JeffDeCola/my-go-examples/tree/master/api/simple-webserver-with-REST)

  _Adding REST (GET, POST, PUT, DELETE) JSON API to my
  [simple-webserver](https://github.com/JeffDeCola/my-go-examples#webserver).
  See example below._

### BASIC PROGRAMMING

_Just cool programs that are very useful and can be used as building blocks for
other cool programs._

* [json](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-programming/json)

  _Encode a struct to json and decode back to a struct._

* [read-file](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-programming/read-file)

  _Reading a file a few different ways._

* [singly-linked-list](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-programming/singly-linked-list)

  _A singly linked list (i.e. using just a head pointer)._

### BASIC SYNTAX

* DATA TYPES

  * [closure](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/data-types/closure)

    _An example of closure (a function that references variables from outside
    its body)._

  * [pointers1](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/data-types/pointers1)

    _A struct passed to function by value (copy) and by address (reference)._

  * [pointers2](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/data-types/pointers2)

    _An int passed to function by address (reference) and by int pointer (reference)._

  * [slices-underlying-array](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/data-types/slices-underlying-array)

    _A slice being appended to showing the underlying array
    being added to the slice._

* FUNCTIONS

  * [callback](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/functions/callback)

    _Passing a function (as an argument) to a function. Not really used that often._

  * [recursion](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/functions/recursion)

    _A function calling itself to make a fibonacci series._

  * [shapes-using-functions](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/functions/shapes-using-functions)

    _Calculating the area and perimeter of
    circles, rectangles and triangles using functions.
    Also refer to **method** and **interface** implementations below._

* INTERFACES

  * [interface](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/interfaces/interface)

    _A simple example of an interface as parameter and an interface as a return.
    Also see the next example that uses this in a package._

  * [interface-package](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/interfaces/interface-package)

    _The same example as above but the interface and methods placed in a package._

  * [interfaces-card-atm-bank](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/interfaces/interfaces-card-atm-bank)

    _Using interfaces to show how a bank card is
    used to interact with an atm and bank._

  * [shapes-using-interfaces](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/interfaces/shapes-using-interfaces)

    _Calculating the area and perimeter of
    circles, rectangles and triangles using interfaces.
    Also refer to **function** and **method** implementations._

* METHODS

  * [shapes-using-methods](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/methods/shapes-using-methods)

    _Calculating the area and perimeter of
    circles, rectangles and triangles using methods.
    Also refer to **function** and **interface** implementations above._

### BLOCKCHAIN

* [bitcoin-ledger](https://github.com/JeffDeCola/my-go-examples/tree/master/blockchain/bitcoin-ledger)
  
  _Demonstrates the bitcoin ledger in a blockchain using the
  **unspent transaction output model**._

* [create-bitcoin-address-from-ecdsa-publickey](https://github.com/JeffDeCola/my-go-examples/tree/master/blockchain/create-bitcoin-address-from-ecdsa-publickey)
  
  _Create a bitcoin address from your ecdsa public key
  using the `crypto/ecdsa` standard package._

* [jeffCoin](https://github.com/JeffDeCola/jeffCoin)
  _(Links to another repo)_

  _I made a working cryptocurrency. This link will take you to that repo._<commit_msg>miner<commit_after># my-go-examples

[![Go Report Card](https://goreportcard.com/badge/github.com/JeffDeCola/my-go-examples)](https://goreportcard.com/report/github.com/JeffDeCola/my-go-examples)
[![GoDoc](https://godoc.org/github.com/JeffDeCola/my-go-examples?status.svg)](https://godoc.org/github.com/JeffDeCola/my-go-examples)
[![Maintainability](https://api.codeclimate.com/v1/badges/3c5477c63d77a071fdff/maintainability)](https://codeclimate.com/github/JeffDeCola/my-go-examples/maintainability)
[![Issue Count](https://codeclimate.com/github/JeffDeCola/my-go-examples/badges/issue_count.svg)](https://codeclimate.com/github/JeffDeCola/my-go-examples/issues)
[![License](http://img.shields.io/:license-mit-blue.svg)](http://jeffdecola.mit-license.org)

_A place to keep my go code snippets and examples._

These go examples also contain a lot of information
I gathered from other sources.

Table of Contents,

* [API](https://github.com/JeffDeCola/my-go-examples#api)
* [BASIC PROGRAMMING](https://github.com/JeffDeCola/my-go-examples#basic-programming)
* [BASIC SYNTAX](https://github.com/JeffDeCola/my-go-examples#basic-syntax)
  * Data Types
  * Functions
  * Interfaces
  * Methods
* [BLOCKCHAIN](https://github.com/JeffDeCola/my-go-examples#blockchain)
* [CGO](https://github.com/JeffDeCola/my-go-examples#cgo)
* [CLOUD SERVICES](https://github.com/JeffDeCola/my-go-examples#cloud-services)
* [CRYPTOGRAPHY](https://github.com/JeffDeCola/my-go-examples#cryptography)
  * ASYMMETRIC CRYPTOGRAPHY
  * HASHING
  * SYMMETRIC CRYPTOGRAPHY
* [DATABASE](https://github.com/JeffDeCola/my-go-examples#database)
* [GOROUTINES](https://github.com/JeffDeCola/my-go-examples#goroutines)
* [JEFFS GO TEMPLATES](https://github.com/JeffDeCola/my-go-examples#jeffs-go-templates)
* [MESSAGING](https://github.com/JeffDeCola/my-go-examples#messaging)
* [PACKAGES](https://github.com/JeffDeCola/my-go-examples#packages)
* [TESTING](https://github.com/JeffDeCola/my-go-examples#testing)
* [WEBSERVER](https://github.com/JeffDeCola/my-go-examples#webserver)

[GitHub Webpage](https://jeffdecola.github.io/my-go-examples/)

## GO EXAMPLES

_All sections in alphabetical order._

### API

* [http-GET-POST](https://github.com/JeffDeCola/my-go-examples/tree/master/api/http-GET-POST)

  _Using the standard `net/http` package to `http.Get` and `http.PostForm`._

* [OAuth-2.0-google-cloud-storage-api](https://github.com/JeffDeCola/my-go-examples/tree/master/api/OAuth-2.0-google-cloud-storage-api)
  _(Under construction - check back soon)_

  _Using OAuth 2.0 to access a users google cloud storage
  (based on scopes) via googles api._

* [OAuth-2.0-google-cloud-storage-api-over-NATS](https://github.com/JeffDeCola/my-go-examples/tree/master/api/OAuth-2.0-google-cloud-storage-api-over-NATS)
  _(Under construction - check back soon)_

  _Using OAuth 2.0 (frontend and backend via protobuf over NATS)
  to access a users google cloud storage (based on scopes) via googles api._

* [simple-tcp-ip-server](https://github.com/JeffDeCola/my-go-examples/tree/master/api/simple-tcp-ip-server)

  _Using the standard `net` package to build a simple tcp server
  to handle requests concurrently over ip (tcp/ip)._

* [simple-webserver-with-REST](https://github.com/JeffDeCola/my-go-examples/tree/master/api/simple-webserver-with-REST)

  _Adding REST (GET, POST, PUT, DELETE) JSON API to my
  [simple-webserver](https://github.com/JeffDeCola/my-go-examples#webserver).
  See example below._

### BASIC PROGRAMMING

_Just cool programs that are very useful and can be used as building blocks for
other cool programs._

* [json](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-programming/json)

  _Encode a struct to json and decode back to a struct._

* [read-file](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-programming/read-file)

  _Reading a file a few different ways._

* [singly-linked-list](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-programming/singly-linked-list)

  _A singly linked list (i.e. using just a head pointer)._

### BASIC SYNTAX

* DATA TYPES

  * [closure](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/data-types/closure)

    _An example of closure (a function that references variables from outside
    its body)._

  * [pointers1](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/data-types/pointers1)

    _A struct passed to function by value (copy) and by address (reference)._

  * [pointers2](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/data-types/pointers2)

    _An int passed to function by address (reference) and by int pointer (reference)._

  * [slices-underlying-array](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/data-types/slices-underlying-array)

    _A slice being appended to showing the underlying array
    being added to the slice._

* FUNCTIONS

  * [callback](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/functions/callback)

    _Passing a function (as an argument) to a function. Not really used that often._

  * [recursion](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/functions/recursion)

    _A function calling itself to make a fibonacci series._

  * [shapes-using-functions](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/functions/shapes-using-functions)

    _Calculating the area and perimeter of
    circles, rectangles and triangles using functions.
    Also refer to **method** and **interface** implementations below._

* INTERFACES

  * [interface](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/interfaces/interface)

    _A simple example of an interface as parameter and an interface as a return.
    Also see the next example that uses this in a package._

  * [interface-package](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/interfaces/interface-package)

    _The same example as above but the interface and methods placed in a package._

  * [interfaces-card-atm-bank](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/interfaces/interfaces-card-atm-bank)

    _Using interfaces to show how a bank card is
    used to interact with an atm and bank._

  * [shapes-using-interfaces](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/interfaces/shapes-using-interfaces)

    _Calculating the area and perimeter of
    circles, rectangles and triangles using interfaces.
    Also refer to **function** and **method** implementations._

* METHODS

  * [shapes-using-methods](https://github.com/JeffDeCola/my-go-examples/tree/master/basic-syntax/methods/shapes-using-methods)

    _Calculating the area and perimeter of
    circles, rectangles and triangles using methods.
    Also refer to **function** and **interface** implementations above._

### BLOCKCHAIN

* [bitcoin-ledger](https://github.com/JeffDeCola/my-go-examples/tree/master/blockchain/bitcoin-ledger)
  
  _Demonstrates the bitcoin ledger in a blockchain using the
  **unspent transaction output model**._

* [create-bitcoin-address-from-ecdsa-publickey](https://github.com/JeffDeCola/my-go-examples/tree/master/blockchain/create-bitcoin-address-from-ecdsa-publickey)
  
  _Create a bitcoin address from your ecdsa public key
  using the `crypto/ecdsa` standard package._

* [jeffCoin](https://github.com/JeffDeCola/jeffCoin)
  _**Links to another repo**_

  _I made a working cryptocurrency. This link will take you to that repo._
{'fraction_non_alphanumeric': 0.1359248975274362, 'fraction_numerical': 0.003834457225968531, 'mean_word_length': 4.451171171171171, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 94, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4833148', 'n_tokens_mistral': 5466, 'n_tokens_neox': 5049, 'n_words': 957}