Skip to content

Instantly share code, notes, and snippets.

@IronCore864
Last active December 7, 2021 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IronCore864/b1f8d0a66548a286e9ec81a39851ee77 to your computer and use it in GitHub Desktop.
Save IronCore864/b1f8d0a66548a286e9ec81a39851ee77 to your computer and use it in GitHub Desktop.
Go Resty with GitHub Releases
package main
import (
"fmt"
"log"
"time"
resty "github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
client.SetOutputDirectory(".")
fmt.Println(time.Now())
resp, err := client.R().SetOutput("v3.68.0.tar.gz").
Get("https://github.com/hashicorp/terraform-provider-aws/archive/refs/tags/v3.68.0.tar.gz")
if err != nil {
log.Fatalf(err.Error())
}
fmt.Println(resp.StatusCode())
fmt.Println(time.Now())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment