translated from https://github.com/lukerosiak/pysec to Go