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 trial

Go Language Go Language Overview Go Syntax Package Variables

Pichaya Prasertsung
Pichaya Prasertsung
843 Points

[ Go language Challenge task ] undefined: sales.total

I try to print sales.total but I get an error "undefined: sales.total" What's wrong with my code?

package sales

var total float32 = 1234.56
package main


func main() {

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! Remember that for a variable to be "exported" or visible to other Go packages the name must be capitalized. Otherwise, it will only be visible inside that package.

Hope this helps! :sparkles:

Pichaya Prasertsung
Pichaya Prasertsung
843 Points

This helps me a lot. Thank you so much !!