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

The arguments types shorthand syntax is wrongly/awkwardly introduced #759

Open
dario-piotrowicz opened this issue Apr 28, 2024 · 0 comments

Comments

@dario-piotrowicz
Copy link
Contributor

It is quite minor, anyways I've noticed that in the integers section (which comes after the hello-world one), the arguments types shorthand syntax is introduced/explained:

func Add(x, y int) int {
return 0
}
```
When you have more than one argument of the same type \(in our case two integers\) rather than having `(x int, y int)` you can shorten it to `(x, y int)`.

What I think is wrong is that the syntax was already used in the hello-world section (but not explained there):

func assertCorrectMessage(t testing.TB, got, want string) {

So the guide is initially using the syntax in the hello-world section without explaining it and it later introduces it.

I think that this could be improved by either:

  • removing the shorthand from the hello-world code:
    -   func assertCorrectMessage(t testing.TB, got, want string) {
    +   func assertCorrectMessage(t testing.TB, got string, want string) {
  • or keeping the shorthand in the hello-world code but then have the shorthand explanation there instead of having it in the integers section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant