Convert CURL commands to Golang code online

Curl command

Examples: GET - POST - JSON - Basic Auth - Files - Form

CURL to Go Online

This tool helps you to generate Go code based on CURL Command. Copy and Paste CURL Command and Generate Go.

What can you do with CURL to Go Converter Online?

  • CURL to Go is very unique tool to convert cURL command to http request of Go. The input provide by the user's cURL command to generate Go Code.
  • This tool saves your time and helps to generate Go code with ease.
  • CURL to Go works well on Windows, MAC, Linux, Chrome, Firefox, Edge and Safari.

what is CURL?

cURL is an open-source command line tool that downloads files from the web. It supports a variety of protocols, including HTTP, HTTPS, FTP, SFTP, TFTP, Gopher and others.

How do convert CURL to Go code? 

Step1: Paste and convert your CURL requests to Go code

Step2: Copy Go code

Convert CURL to Go example

CURL
cURL example.com
Go Code
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	req, err := http.NewRequest("GET", "http://example.com", nil)
	if err != nil {
		log.Fatal(err)
	}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()
	bodyText, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}