This file contains 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
// DecodeJSONResp decodes the body of the given response into the given target. | |
// If an error occurs, instead of only returning the unmarshaling error, the error will also contain the first 100 chars | |
// of the response JSON. This allows for better debugging. | |
func DecodeJSONResp(resp *http.Response, target interface{}) error { | |
pr, pw := io.Pipe() | |
tr := io.TeeReader(resp.Body, pw) | |
respCh := make(chan string) | |
errCh := make(chan error) | |
go func() { |
This file contains 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
#!/bin/bash | |
# | |
# For easily switching between .envrc files. | |
# | |
# This allows you to have and use multiple .envrc files in the same | |
# directory, like .envrc.test, .envrc.local and .envrc.prod. | |
# | |
# Usage: | |
# | |
# denv [extension] |