From b8e4a6d776707bf857430ddc3666aae794a87edf Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 21 Aug 2022 02:34:43 +0700 Subject: all: fix all linter warnings Some linter, govet, warns about possible copied Mutex on HttpRequest. To fix this we implement method clone and Stringer on HttpRequest. --- example/example.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'example/example.go') diff --git a/example/example.go b/example/example.go index 25c1532..04c94fa 100644 --- a/example/example.go +++ b/example/example.go @@ -374,8 +374,11 @@ func (ex *Example) pathExampleErrorGet(epr *libhttp.EndpointRequest) ([]byte, er return nil, liberrors.Internal(fmt.Errorf("server error")) } -func (ex *Example) pathExamplePost(epr *libhttp.EndpointRequest) ([]byte, error) { - epr.HttpRequest.ParseMultipartForm(0) +func (ex *Example) pathExamplePost(epr *libhttp.EndpointRequest) (resb []byte, err error) { + err = epr.HttpRequest.ParseMultipartForm(0) + if err != nil { + return nil, err + } data := &requestResponse{ Method: epr.HttpRequest.Method, @@ -469,18 +472,18 @@ func (ex *Example) preattackExampleGet(rr *trunks.RunRequest) { func (ex *Example) attackExampleErrorGet(rr *trunks.RunRequest) vegeta.Targeter { return func(tgt *vegeta.Target) error { - rr.HttpTarget.AttackLocker.Lock() + rr.HttpTarget.Lock() *tgt = ex.targetExampleErrorGet - rr.HttpTarget.AttackLocker.Unlock() + rr.HttpTarget.Unlock() return nil } } func (ex *Example) attackExampleGet(rr *trunks.RunRequest) vegeta.Targeter { return func(tgt *vegeta.Target) error { - rr.HttpTarget.AttackLocker.Lock() + rr.HttpTarget.Lock() *tgt = ex.targetExampleGet - rr.HttpTarget.AttackLocker.Unlock() + rr.HttpTarget.Unlock() return nil } } @@ -545,9 +548,9 @@ func (ex *Example) preattackExamplePostForm(rr *trunks.RunRequest) { func (ex *Example) attackExamplePostForm(rr *trunks.RunRequest) vegeta.Targeter { return func(tgt *vegeta.Target) error { - rr.HttpTarget.AttackLocker.Lock() + rr.HttpTarget.Lock() *tgt = ex.targetExamplePostForm - rr.HttpTarget.AttackLocker.Unlock() + rr.HttpTarget.Unlock() return nil } } -- cgit v1.3