After running...
go run main.go
I get this error
go : The term 'go' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
Check for Missing Modules in PowerShell If the module is missing or damaged, PowerShell won't be able to execute it. By default, you have to install modules in the exact order to use them. If that module is missing, corrupt, or got moved, it throws up the error, “the term is not recognized as the name of a cmdlet.”
If you see the error "The term 'cl.exe' is not recognized as the name of a cmdlet, function, script file, or operable program.", this usually means you are running VS Code outside of a Developer Command Prompt for Visual Studio and VS Code doesn't know the path to the cl.exe compiler.
SOLVED: Go to visual studio code (assuming this is installed) ctrl + shift + p to open command window type
Go: current GOPATH
this should give you a path create a system environment variable named GOPATH and add that path into that variable.
Make sure the system environment variables are set to:
GOPATH is set (in my case) to C:\Users[username]\go
GOROOT is set to C:\go\
IDE is Visual Studio Code.
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
write the code to the terminal and run it. Eazy way to solve the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With