Visual Studio Code isn't recognizing Go functions

I’m brand new, trying to use VS Code as my editor. I’ve downloaded to Go Plugin, but when I write code, it still isn’t recognizing it, meaning nothing is popping up automatically like it does in the video I’m learning from.

I you look right at the bottom is there a text “Go Tools Missing”?

If so click it wait till all Go Tools are installed and restarting vscode should work…
If feel free to ping me for help.

1 Like

Thanks. It’s working now, however I have a new issue. I’m learning from a Udemy class and the guy isn’t using VSC, so it’s a bit difficult. I’m on the “Hello World” task, but it doesn’t seem to be registering for me. Here’s the code that I’m putting into VSC:

package main

import “fmt”

func main() {
fmt.Println(“Hello World!”)

But then when I go to either the terminal in VSC or my other one in Git Bash, I get an this message: PS C:\Users\Chris> go fmt
main.go:7:1: expected declaration, found ‘IDENT’ function
exit status 2

Maybe I have it pointed to the wrong folder - so far, we’ve been putting everything in a “Go Workspace” that’s different from “C:\Users\Chris” but I don’t know how to change that, or if I even should.

normally if everything is installed correctly go fmt
should format the code in the right way…

To make sure vscode is working correctly I would run the code samples at the Go Playground first.

At the Playground next to the Run button there is a Format button which runs go fmt, so you can also cross check if your code doesn’t have any format errors which may cause your problems.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.