Golang – run external command

Run command in bash: func runExternalCmd(commandToRun string) { fmt.Println(curTime()+"running command:", commandToRun) cmd := exec.Command("bash", "-c", commandToRun) err := cmd.Start() if err != nil { fmt.Println(err)...

Golang – useful notes

Time/ date get yesterday date: t := time.Now().UTC().AddDate(0, 0, -1) t := time.Now().Add(-24*time.Hour) get only date part: t := time.Now().UTC().AddDate(0, 0, -1) d := fmt.Sprintf("%d-%02d-%02d", t.Year(), t.Month(), t.Day()) time format:...

Golang – install google libraries

https://cloud.google.com/appengine/docs/go/googlecloudstorageclient/setting-up-cloud-storage go get -u golang.org/x/oauth2 go get -u cloud.google.com/go/storage go get -u google.golang.org/appengine/... libraries are expected in directories...