Skip to content

Instantly share code, notes, and snippets.

View BradLugo's full-sized avatar

Brad Lugo BradLugo

View GitHub Profile
@BradLugo
BradLugo / fox.Dockerfile
Created April 3, 2020 00:26
Dockerfile to somewhat simulate the UTSA fox servers
# Rename to Dockerfile in local directory
# Run docker build -t <assign#> . (e.g., docker build -t assign1 .)
# Run docker run --rm -it <assign#> (e.g., docker run --rm -it assign1)
FROM ubuntu:14.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install gcc valgrind make -y
RUN mkdir /code
WORKDIR /code
@BradLugo
BradLugo / PopulateConfigs.go
Last active August 22, 2019 18:04
reflection
// Dynamically populate the toPopulate struct fields using viper and reflection
func PopulateConfigs(toPopulate interface{}) (returnError error) {
var fieldNameError string
defer func() {
if r := recover(); r != nil {
switch r.(type) {
case string:
returnError = errors.New(fmt.Sprintf(
"Cast conversion error for %s. Please check your configuration", fieldNameError))