go-kit / go-kit/examples

Typo in https://gokit.io/examples/stringsvc.html#client-side-endpoints

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
375
Forks
113
PR merge metrics
No merged PRs in 30d

Description

# Typo with non-compiling code in documentation

Hello 👋 I'm going through the https://gokit.io/examples/stringsvc.html walkthrough right now and found a line that doesn't match up with `endpoint.Endpoint`'s signature.

```go
func (mw proxymw) Uppercase(s string) (string, error) {
response, err := mw.uppercase(uppercaseRequest{S: s}) // 👈 This line doesn't work
if err != nil {
return "", err
}
resp := response.(uppercaseResponse)
if resp.Err != "" {
return resp.V, errors.New(resp.Err)
}
return resp.V, nil
}
```

Should be

```go
func (mw proxymw) Uppercase(s string) (string, error) {
response, err := mw.uppercase(context.Background(), uppercaseRequest{S: s})
if err != nil {
return "", err
}
resp := response.(uppercaseResponse)
if resp.Err != "" {
return resp.V, errors.New(resp.Err)
}
return resp.V, nil
}
```

Not sure where to address this, so if there is another location to bring this to let me know!

Cheers :beers:

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.