Start with a Dockerfile:
FROM golang:latest
RUN apt-get update -y && apt-get install git -y
CMD ["/bin/bash"]
Start with a Dockerfile:
FROM golang:latest
RUN apt-get update -y && apt-get install git -y
CMD ["/bin/bash"]
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func main() { | |
var jsonBlob = []byte(`[ | |
{"str": "Foo", "num": "1", "bool": "true", "its": 3}, |
# Check that given variables are set and all have non-empty values, | |
# die with an error otherwise. | |
# | |
# PARAMS: | |
# 1. Variable name(s) to test. | |
# 2. (optional) Error message to print. | |
# | |
# EXAMPLE: | |
# @:$(call check_defined, ENV_REGION, you must set ENV_REGION=usc1|awsuse2) | |
# |
First install VirtualBox:
https://www.virtualbox.org/wiki/Testbuilds
Next download the Windows ISO:
https://www.microsoft.com/software-download/windows11
Watch this video which explains some of the VirtualBox setup:
https://www.youtube.com/watch?v=1BOcED3RFGM&t=1s
This directory contains a Compute application that proxies incoming requests onto https://http-me.glitch.me/.
There is a run.sh
script which will attempt to validate the
.PHONY: bin-viceroy | |
bin-viceroy: # Download latest version of Viceroy to ./bin/ directory | |
@arch=$$(uname -m | sed 's/x86_64/amd64/'); \ | |
os=$$(uname -s | tr '[:upper:]' '[:lower:]'); \ | |
url=$$(curl -s https://api.github.com/repos/fastly/viceroy/releases/latest | jq --arg arch $$arch --arg os $$os -r '.assets[] | select((.name | contains($$arch)) and (.name | contains($$os))) | .browser_download_url'); \ | |
filename=$$(basename $$url); \ | |
curl -sLO $$url && mkdir -p bin && tar -xzvf $$filename --directory ./bin/ && \ | |
./bin/viceroy --version && rm $$filename && sudo cp ./bin/viceroy /usr/local/bin/viceroy # NOTE: sudo is a no-op in GitHub Actions |
// https://play.golang.com/p/fLovZCiAzn1 | |
package main | |
import ( | |
"fmt" | |
) | |
type myString string | |
func main() { |
// https://go.dev/play/p/dgMult9xaao | |
// | |
// Code copied verbatim from https://github.com/veqryn/slog-dedup | |
package main | |
import ( | |
"context" | |
"fmt" | |
"log/slog" |
// structs are considered a primitive type and as such are passed by value. | |
// but if you have a pointer to struct you need to be careful not to assign it to a variable thinking you're getting a copy of the 'value'. | |
// you're only getting a copy of the 'pointer'! which means the newly assigned variable will mutate the underlying struct. | |
// so to make a copy you have to dereference the struct pointer first. | |
package main | |
import "fmt" | |
type Foo struct { |
// This is a file designed to be run on go.dev/play (link below). | |
// It validates the behaviour of init() functions. | |
// i.e. init() is only called once regardless of how many times its package is imported. | |
// https://go.dev/play/p/99YpDma6mVJ | |
package main | |
import ( | |
"play.ground/bar" | |
"play.ground/foo" | |
) |