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 Error Return Values

Mr. & Mrs. (to be) Miles
Mr. & Mrs. (to be) Miles
380 Points

I cant figure out what's wrong with line 11

//code below. cant figure out what's wrong with line 11

package files

import ("os" "fmt" )

func Size(fileName string) (int64, error) { fileInfo, err := os.Stat(fileName) if err != nil { // RETURN THE VALUES 0 AND err return 0, fmt.Println(err)
} return fileInfo.Size(), nil // RETURN THE VALUES fileInfo.Size() AND nil }

src/code.my.com/git/files/files.go
package files

import ("os"
                "fmt"
        )

func Size(fileName string) (int64, error) {
  fileInfo, err := os.Stat(fileName)
  if err != nil {
  // RETURN THE VALUES 0 AND err
    return 0, fmt.Println(err)  
  }
  return fileInfo.Size(), nil
  // RETURN THE VALUES fileInfo.Size() AND nil
}

1 Answer

Steven Parker
Steven Parker
231,248 Points

The instructions (and the code comment) both tell you to "RETURN THE VALUES 0 AND err". This can be taken just as literally as the other comment. You wont need to call "fmt.Println" or import "fmt".