Created
August 22, 2017 23:33
-
-
Save hectorgool/1ef09c329146a4979a1d28cd5a950b5a to your computer and use it in GitHub Desktop.
exec curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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