Using Variadic in Go

Nothing new Variadic arguments are present in many many languages. In golang the syntax is like so: package main import "fmt" func addNubers(nums ...int) int { s := 0 for _, n := range nums { s += n } return s } func main() { res := addNubers(1,2,3) } In python: def func(a, *t): for e in t: print(e) func(1,2,3,3,4) Usage in go In go variadic functions are used to make configuration easily extendable, without changing existing interface....

October 3, 2021 · 1 min · Nolan

Using GOPROXY

Getting dependencies via GOPROXY I recently wanted to use a private registry in a go project. It can be for many reasons: ensure immutability from one built to another ensure avaibility of a build (remember npm author who removed his library and broke half the internet?) get non-public library How it works Quick & Easy It is super easy you just have to add an env variable: export GOPROXY="myprivateserver....

April 19, 2021 · 1 min · Nolan