examples icon indicating copy to clipboard operation
examples copied to clipboard

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

Open j-mnr opened this issue 2 years ago • 0 comments

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.

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

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:

j-mnr avatar Aug 04 '22 08:08 j-mnr