Error: "The term 'go' is not recognized" While Running 'go run main.go'
When executing the command go run main.go, users might encounter the following 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.
This issue arises because the 'go' command may not be accessible from the current path. To resolve this, run the following command in the terminal:
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
This modifies the system's path variable to include the appropriate path to the 'go' command. After running this command, users can execute 'go run main.go' without encountering the error.
The above is the detailed content of Why is the `go` command not recognized when I run `go run main.go`?. For more information, please follow other related articles on the PHP Chinese website!