Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Go Go Language Overview Custom Types Structs

Arihant Banthia
Arihant Banthia
3,950 Points

Didn't understand the question

What is being asked to do in this question

src/clock/clock.go
package clock

type Clock struct {
  Hours int
  Minutes int
}

// DEFINE A "Noon" FUNCTION HERE
func Noon(t *Clock) Clock {
  r:=Clock{}
  r.Hours=12
  r.Minutes=0
  return r
}
Antoine Solomon
Antoine Solomon
2,850 Points

Do you need that argument to the Noon function? After all you are initializing the r variable to a new instance of Clock and eventually returning r

1 Answer

Bas Kuunk
Bas Kuunk
21,308 Points

The function should just return a Clock instance, which you do correctly, but it should not take any input. They ask for a regular function in the package, not a method on the type.

Remove the inputs and replace the body of the function as per the following:

func Noon() Clock {
  return Clock{12, 0}
}