Codebase list golang-github-ncw-swift / 8d121fa0-d69f-400e-9ef9-7e42d7a9ec08/main compatibility_1_1.go
8d121fa0-d69f-400e-9ef9-7e42d7a9ec08/main

Tree @8d121fa0-d69f-400e-9ef9-7e42d7a9ec08/main (Download .tar.gz)

compatibility_1_1.go @8d121fa0-d69f-400e-9ef9-7e42d7a9ec08/mainraw · history · blame

// Go 1.1 and later compatibility functions
//
//go:build go1.1
// +build go1.1

package swift

import (
	"net/http"
	"time"
)

// Cancel the request
func cancelRequest(transport http.RoundTripper, req *http.Request) {
	if tr, ok := transport.(interface {
		CancelRequest(*http.Request)
	}); ok {
		tr.CancelRequest(req)
	}
}

// Reset a timer
func resetTimer(t *time.Timer, d time.Duration) {
	t.Reset(d)
}