06 April, 2019

TIL #15 - go modules, bad db records, alpine image, go typecasts

Notes taken between: 1-5 April 2019


skipping bad records

most DB tables have a pointer skip table so you have a record of all the bad events if you wanted to replay them.

go modules

go.mod is similar to Gopkg.toml go.sum is similar to Goplg.lock Only direct dependencies are recorded in the go.mod file:

to make a file executable js>chmod -x .<filepath>/pipeline.ymlgit will track that its an executable. you can then check thats its changed by: js>diff --git a/.<path>/<file> b/.<path>/<file> old mode 100644 new mode 100755

alpine

alpine images dont come with bash so to write a script dont forget to use js>#!/bin/sh instead of #!/bin/bash

go has two flavours of typecasts:

  • raw.(*Session): take a pointer and assert that its concrete was already a Session, so you can use it as a session
  • Session(raw): try and convert raw (not an interface, but another concrete type) into a session

GOROOT should be blank (defaults to /usr/local/go/ or similar), or the root of your go sources GOPATH should be blank (defaults to ~/go) or the root of your go user sources