Go hello world exercise trouble

1.PROBLEM
Hello. I use Go to do hello world exercise and donnot know how to fix this error.
Actually I tried this program below in Vscode and DOS, It can return “Hello, World!”
捕获

2.MY PROGRAM:
package greeting
import “fmt”
// HelloWorld greets the world.
func main(){
fmt.Println “Hello, World!”
}

3.THE ERROR MESSAGE:

We received the following error when we ran your code:

FAIL	greeting [build failed]
# greeting [greeting.test]
./hello_world.go:5:17: syntax error: unexpected literal "Hello, World!" at end of statement
'/usr/local/go/bin/go test --short --json .' returned exit code 1: exit status 1

Println, like all functions, require () in order to invoke it:
fmt.Println("Hello, World!")

However, this exercise is asking us to define a func named HelloWorld(), which has to return that string rather than print it.

Hi!

This first exercise is meant to help you understand how Exercism works. Did you watch the video on the Hello World page? In it Jeremy explains what you need to do to solve this exercise. You can reset the code by clicking on the three horizontal dots ··· at the upper right corner of the website.

Note, Exercism does not ask you to write a main package. You’re expected to write a function which can be called by the main package.

2 Likes

I tried to use “return” and used AI to understand the final program, now I finally solved this problem!
Thank you for helping me! :smiling_face_with_three_hearts:

1 Like

:cry: I think it’s because the internet connection here is poor, the video on page won’t play. Thankfully, AI is still usable, and thanks to who replied to this post. I finally solved this problem. :partying_face: