Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 2.16 KB

sample.md

File metadata and controls

42 lines (26 loc) · 2.16 KB

Hi GoLover123!

Welcome to Exercism and welcome to learning Go! Nice to meet you!

This looks good!

Here are some thoughts for further improvement:

  • I see you referenced the names Alice and Bob directly in your code. This is OK, but it would be better if the ShareWith function worked with any name supplied to it. See if you can figure out how to change your code to make this work.

  • The comment describing the package twofer isn't quite in the standard format. The section on comments below may help you fix this.

  • Currently you are repeating most of the output string. This is OK, but in general, Go programmers try to avoid duplicating code where they can avoid it. Can you work out how to restructure your code so that you don't repeat yourself?


Go has great guidelines about how to write comments. There's a standard format you can use for documentation comments, which can then be turned into beautiful documentation automatically by the godoc tool.

The package comment should start with the word Package followed by the package name, like this:

// Package cook provides handy conversion methods for units typically used in recipes.
package cook

For exported functions, methods, constants, and package variables, the comment should start with the name, and continue with a verb phrase:

// TbsToMl converts tablespoons to milliliters.
func TbsToMl(tbs int) int {
	// ...
}

The CodeReviewComments wiki further specifies that doc comments should be full sentences, ending with a period.

In addition to optimizing for readability, following the recommendations improves how your code looks in Go's documentation tools such as godoc.org, godoc, and go doc.

Take a moment to read the section on doc comments in the official style guide, Effective Go to see the reasoning behind these choices.


Feel free to ask if you have questions or want to know more. I'd love to help!