diff options
| author | Shulhan <ms@kilabit.info> | 2023-11-11 13:33:11 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-11-11 13:34:43 +0700 |
| commit | 08852664aa6952e727addb0c24ad8f56274e09bb (patch) | |
| tree | d4f59e9000a2676bf1c5952c0cbeb6a5ff1f7443 /example | |
| parent | e56ee3e03a34fa738b626a4fd22fbc051bf7f0b0 (diff) | |
| download | gorankusu-08852664aa6952e727addb0c24ad8f56274e09bb.tar.xz | |
Makefile: replace the Go linter and apply all their recommendations
Previously, we use golangci-lint as linter.
This linter does not provides any useful recommendation lately and the
development is quite a mess, sometimes its break when using Go tip.
In this changes we replace it with revive, fieldalignment, and shadow;
and fix all of their recommendations.
Diffstat (limited to 'example')
| -rw-r--r-- | example/example.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/example/example.go b/example/example.go index 73efe51..332cbb3 100644 --- a/example/example.go +++ b/example/example.go @@ -48,6 +48,7 @@ type requestResponse struct { Body string } +// Example contains an example how to use Trunks programmatically. type Example struct { trunks *trunks.Trunks wsServer *websocket.Server @@ -102,6 +103,7 @@ func New() (ex *Example, err error) { return ex, nil } +// Start the Example servers. func (ex *Example) Start() (err error) { go func() { err = ex.wsServer.Start() @@ -113,6 +115,7 @@ func (ex *Example) Start() (err error) { return ex.trunks.Start() } +// Stop the Example servers. func (ex *Example) Stop() { ex.wsServer.Stop() ex.trunks.Stop() @@ -370,7 +373,7 @@ func (ex *Example) pathExampleGet(epr *libhttp.EndpointRequest) ([]byte, error) return json.Marshal(&res) } -func (ex *Example) pathExampleErrorGet(epr *libhttp.EndpointRequest) ([]byte, error) { +func (ex *Example) pathExampleErrorGet(_ *libhttp.EndpointRequest) ([]byte, error) { return nil, liberrors.Internal(fmt.Errorf("server error")) } @@ -550,7 +553,7 @@ func (ex *Example) attackExamplePostForm(rr *trunks.RunRequest) vegeta.Targeter } } -func (ex *Example) handleWSExampleGet(ctx context.Context, req *websocket.Request) (res websocket.Response) { +func (ex *Example) handleWSExampleGet(_ context.Context, req *websocket.Request) (res websocket.Response) { res.ID = req.ID res.Code = http.StatusOK res.Body = req.Body |
