Skip to content

Instantly share code, notes, and snippets.

@hectorgool
Created August 22, 2017 23:33
Show Gist options
  • Save hectorgool/1ef09c329146a4979a1d28cd5a950b5a to your computer and use it in GitHub Desktop.
Save hectorgool/1ef09c329146a4979a1d28cd5a950b5a to your computer and use it in GitHub Desktop.
exec curl
/*
twitter@hector_gool
*/
package main
import (
"fmt"
"os"
"os/exec"
)
const max = 10
func main() {
curl :=
`
curl -u $ELASTICSEARCH_USERNAME:$ELASTICSEARCH_PASSWORD -XGET $ELASTICSEARCH_HOSTS:$ELASTICSEARCH_PORT
`
out, err := exec.Command("sh", "-c", curl).Output()
printError(err)
fmt.Printf("%s\n\n",out)
}
func printError(err error) {
if err != nil {
fmt.Printf("\nError: %v \n ", err.Error())
os.Exit(1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment