curl-to-Go

Instantly convert curl commands to Go code

This tool turns a curl command into Go code. (To do the reverse, check out sethgrid/gencurl.) Currently, it knows the following options: -d/--data, -H/--header, -I/--head, -u/--user, --url, and -X/--request. It also understands JSON content types. As always, be sure to go fmt your code and pay attention to imports. There's probably bugs; please contribute on GitHub! For a quick way to generate a Go struct from JSON, see JSON-to-Go.

Example 1 · Example 2 · Example 3 · Example 4 · Example 5