diff options
| author | Shulhan <ms@kilabit.info> | 2022-08-21 02:34:43 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-08-21 02:34:43 +0700 |
| commit | b8e4a6d776707bf857430ddc3666aae794a87edf (patch) | |
| tree | 601ffeaac1b0a34d88f8be903ff81bd62e0fdf03 /example/example.go | |
| parent | 6e27a84dba52e68fe7b75df50190934ab96c1946 (diff) | |
| download | gorankusu-b8e4a6d776707bf857430ddc3666aae794a87edf.tar.xz | |
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.
Diffstat (limited to 'example/example.go')
| -rw-r--r-- | example/example.go | 19 |
1 files changed, 11 insertions, 8 deletions
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 } } |
