Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialsrikanth Alluri
5,505 PointsUnable to execute the program. Its showing this message: src/clock/clock_test.go:21: undefined: Noon
package clock
import "fmt"
type Clock struct { Hours int Minutes int }
// DEFINE A "Noon" FUNCTION HERE
func (c *Clock) Noon() { c.Hours = 12 c.Minutes = 0 }
func main() { clock := Clock{} clock.Noon() fmt.Println(clock) }
When i'm trying to execute above code , its printing this message: "src/clock/clock_test.go:21: undefined: Noon". Not sure what's causing this issue. Can anyone help me out with this one ?
1 Answer
Steven Parker
231,236 PointsThe instructions say, "Write a Noon function that returns a new Clock ..."
You might want to review the syntax for declaring what a function returns. And you'll need to create a new "Clock" before you can set values in it, and then remember to return it.
Also, creating a "main" function isn't mentioned in the instructions, and is not part of this challenge.