Converter
Convert curl to Go
Paste any curl command and get a ready-to-run Go net/http equivalent — headers, auth, JSON body, all handled. Credentials use os.Getenv automatically.
Example
curl input
curl -X POST https://api.github.com/repos/owner/repo/issues \
-H "Authorization: Bearer ghp_REDACTED" \
-H "Content-Type: application/json" \
-d '{"title":"Bug report","body":"Something is broken"}'Go output
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]string{
"title": "Bug report",
"body": "Something is broken",
})
req, _ := http.NewRequest("POST",
"https://api.github.com/repos/owner/repo/issues",
bytes.NewBuffer(body),
)
req.Header.Set("Authorization", "Bearer "+os.Getenv("GITHUB_TOKEN"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp.Status)
}