Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: Incorrect information displayed about Trim function. [A typo] #49494

Closed
ashishk1331 opened this issue Nov 10, 2021 · 3 comments
Closed

Comments

@ashishk1331
Copy link

What is the URL of the page with the issue?

URL : https://pkg.go.dev/strings#Trim

What is your user agent?

Mozilla/5.0 (Linux; Android 11; SM-M315F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Mobile Safari/537.36

Screenshot

Screenshot_20211110-135416_Chrome

What did you do?

The trim function outputs string but in the text about it it's mention that it outputs slice of the string.

What did you expect to see?

What did you see instead?

@gopherbot gopherbot added this to the pkgsite/unplanned milestone Nov 10, 2021
@seankhliao
Copy link
Member

the documentation is correct it slices to return part of the string

@ashishk1331
Copy link
Author

Screenshot_20211110-135416_Chrome

Listen returning of " a slice of the string" seems to be this []string but instead the function is returning simple "string" as in its function signature. I think I'm looking at a grammatical mistake.
If it were to return a slice of a string then it would be
func Trim(s, cutset string) []string
But the syntax is
func Trim(s, cutset string) string

What do you think?

@seankhliao
Copy link
Member

seankhliao commented Nov 12, 2021

[]string would be "slice of strings"
what trim does is something like s := "hello world", s[1:5], which is a slice of the string

@golang golang locked and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants