Skip to content

Commit

Permalink
style: // nolint: → //nolint:
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
  • Loading branch information
maxatome committed Apr 15, 2024
1 parent c72d04a commit e224b26
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion internal/error.go
Expand Up @@ -7,7 +7,7 @@ import (

// NoResponderFound is returned when no responders are found for a
// given HTTP method and URL.
var NoResponderFound = errors.New("no responder found") // nolint: revive
var NoResponderFound = errors.New("no responder found") //nolint: revive

// ErrorNoResponderFoundMistake encapsulates a NoResponderFound
// error probably due to a user error on the method or URL path.
Expand Down
14 changes: 7 additions & 7 deletions response.go
Expand Up @@ -576,7 +576,7 @@ func NewBytesResponder(status int, body []byte) Responder {
// To pass the content of an existing file as body use [File] as in:
//
// httpmock.NewJsonResponse(200, httpmock.File("body.json"))
func NewJsonResponse(status int, body any) (*http.Response, error) { // nolint: revive
func NewJsonResponse(status int, body any) (*http.Response, error) { //nolint: revive
encoded, err := json.Marshal(body)
if err != nil {
return nil, err
Expand All @@ -592,7 +592,7 @@ func NewJsonResponse(status int, body any) (*http.Response, error) { // nolint:
// To pass the content of an existing file as body use [File] as in:
//
// httpmock.NewJsonResponder(200, httpmock.File("body.json"))
func NewJsonResponder(status int, body any) (Responder, error) { // nolint: revive
func NewJsonResponder(status int, body any) (Responder, error) { //nolint: revive
resp, err := NewJsonResponse(status, body)
if err != nil {
return nil, err
Expand All @@ -616,7 +616,7 @@ func NewJsonResponder(status int, body any) (Responder, error) { // nolint: revi
// To pass the content of an existing file as body use [File] as in:
//
// httpmock.NewJsonResponderOrPanic(200, httpmock.File("body.json"))
func NewJsonResponderOrPanic(status int, body any) Responder { // nolint: revive
func NewJsonResponderOrPanic(status int, body any) Responder { //nolint: revive
responder, err := NewJsonResponder(status, body)
if err != nil {
panic(err)
Expand All @@ -631,7 +631,7 @@ func NewJsonResponderOrPanic(status int, body any) Responder { // nolint: revive
// To pass the content of an existing file as body use [File] as in:
//
// httpmock.NewXmlResponse(200, httpmock.File("body.xml"))
func NewXmlResponse(status int, body any) (*http.Response, error) { // nolint: revive
func NewXmlResponse(status int, body any) (*http.Response, error) { //nolint: revive
var (
encoded []byte
err error
Expand All @@ -655,7 +655,7 @@ func NewXmlResponse(status int, body any) (*http.Response, error) { // nolint: r
// To pass the content of an existing file as body use [File] as in:
//
// httpmock.NewXmlResponder(200, httpmock.File("body.xml"))
func NewXmlResponder(status int, body any) (Responder, error) { // nolint: revive
func NewXmlResponder(status int, body any) (Responder, error) { //nolint: revive
resp, err := NewXmlResponse(status, body)
if err != nil {
return nil, err
Expand All @@ -679,7 +679,7 @@ func NewXmlResponder(status int, body any) (Responder, error) { // nolint: reviv
// To pass the content of an existing file as body use [File] as in:
//
// httpmock.NewXmlResponderOrPanic(200, httpmock.File("body.xml"))
func NewXmlResponderOrPanic(status int, body any) Responder { // nolint: revive
func NewXmlResponderOrPanic(status int, body any) Responder { //nolint: revive
responder, err := NewXmlResponder(status, body)
if err != nil {
panic(err)
Expand Down Expand Up @@ -746,7 +746,7 @@ func (d *dummyReadCloser) Read(p []byte) (n int, err error) {

func (d *dummyReadCloser) Close() error {
d.setup()
d.body.Seek(0, io.SeekEnd) // nolint: errcheck
d.body.Seek(0, io.SeekEnd) //nolint: errcheck
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions transport.go
Expand Up @@ -414,7 +414,7 @@ func (m *MockTransport) Responders() []string {

func runCancelable(responder Responder, req *http.Request) (*http.Response, error) {
ctx := req.Context()
if req.Cancel == nil && ctx.Done() == nil { // nolint: staticcheck
if req.Cancel == nil && ctx.Done() == nil { //nolint: staticcheck
resp, err := responder(req)
return resp, internal.CheckStackTracer(req, err)
}
Expand All @@ -432,7 +432,7 @@ func runCancelable(responder Responder, req *http.Request) (*http.Response, erro

go func() {
select {
case <-req.Cancel: // nolint: staticcheck
case <-req.Cancel: //nolint: staticcheck
resultch <- result{
response: nil,
err: errors.New("request canceled"),
Expand Down Expand Up @@ -707,7 +707,7 @@ found:
if mr.responder != nil {
m.regexpResponders = append(m.regexpResponders, rxResp)
}
break // nolint: staticcheck
break //nolint: staticcheck
}

mrk := matchRouteKey{
Expand Down Expand Up @@ -951,7 +951,7 @@ func sortedQuery(m url.Values) string {
sort.Strings(keys)

var b bytes.Buffer
var values []string // nolint: prealloc
var values []string //nolint: prealloc

for _, k := range keys {
// Do not alter the passed url.Values
Expand Down
12 changes: 6 additions & 6 deletions transport_test.go
Expand Up @@ -684,7 +684,7 @@ func TestMockTransportRespectsCancel(t *testing.T) {
switch c.withCancel {
case cancelReq:
cancel := make(chan struct{}, 1)
req.Cancel = cancel // nolint: staticcheck
req.Cancel = cancel //nolint: staticcheck
if c.cancelNow {
cancel <- struct{}{}
}
Expand Down Expand Up @@ -757,12 +757,12 @@ func TestMockTransportCallCountReset(t *testing.T) {
require.CmpNoError(err)

buff := new(bytes.Buffer)
json.NewEncoder(buff).Encode("{}") // nolint: errcheck
json.NewEncoder(buff).Encode("{}") //nolint: errcheck
_, err = http.Post(url2, "application/json", buff)
require.CmpNoError(err)

buff.Reset()
json.NewEncoder(buff).Encode(`{"pipo":"bingo"}`) // nolint: errcheck
json.NewEncoder(buff).Encode(`{"pipo":"bingo"}`) //nolint: errcheck
_, err = http.Post(url2, "application/json", buff)
require.CmpNoError(err)

Expand Down Expand Up @@ -808,12 +808,12 @@ func TestMockTransportCallCountZero(t *testing.T) {
require.CmpNoError(err)

buff := new(bytes.Buffer)
json.NewEncoder(buff).Encode("{}") // nolint: errcheck
json.NewEncoder(buff).Encode("{}") //nolint: errcheck
_, err = http.Post(url2, "application/json", buff)
require.CmpNoError(err)

buff.Reset()
json.NewEncoder(buff).Encode(`{"pipo":"bingo"}`) // nolint: errcheck
json.NewEncoder(buff).Encode(`{"pipo":"bingo"}`) //nolint: errcheck
_, err = http.Post(url2, "application/json", buff)
require.CmpNoError(err)

Expand Down Expand Up @@ -1122,7 +1122,7 @@ func TestSubmatches(t *testing.T) {
}{
{
Name: "GetSubmatch & n < 1",
Fn: func() { httpmock.GetSubmatch(req, 0) }, // nolint: errcheck
Fn: func() { httpmock.GetSubmatch(req, 0) }, //nolint: errcheck
PanicPrefix: "getting submatches starts at 1, not 0",
},
{
Expand Down

0 comments on commit e224b26

Please sign in to comment.