I am learning Go lang by this video tutorial https://youtu.be/LOn1GUsjOF4?t=163 . My environment: Windows 11 x64, Visual Studio Code 1.75.1 (latest), Go v1.20.1 (latest).
File main.go
package main
import "fmt"
func main() {
fmt.Println("We good")
}
File go.mod
module newsfeeder
go 1.20
File makefile
dev:
go run main.go
PS D:temp2023_02_24newfeeder> go mod init newsfeeder
go: creating new go.mod: module newsfeeder
go: to add module requirements and sums:
go mod tidy
PS D:temp2023_02_24newfeeder> go run .main.go
hi
PS D:temp2023_02_24newfeeder> go run .main.go
hi
PS D:temp2023_02_24newfeeder> go run .main.go
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.
At line:1 char:1
+ make dev
+ ~~~~
+ CategoryInfo : ObjectNotFound: (make:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS D:temp2023_02_24newfeeder>
How can I fix it?
2
Answers
go to https://sourceforge.net/projects/mingw/postdownload , download, install
Set environment PATH , run "C:MinGWbinmingw-get.exe"
The
ms-vscode.makefile-tools
extension does not come with an installation of themake
program.See this quote from
bobrow
, one of the maintainers of the extension on GitHub:For your learning purposes, all I did to find that GitHub issue (where the issue ticket raiser pretty much has the same problem as you- or at least- has the same error message as you), is google "
"function, script file, or operable program" site:github.com/Microsoft/vscode-makefile-tools/issues
".You need to make sure your either already have it installed with your (C or C++) compiler or install it yourself, and make sure that it is visible in the
PATH
environment variable when you run VS Code (which usually means adding the directory containing the executable to your system path, which will usually be done for you when running installers or installing things via package-management systems). Since in your case you are on Windows, and you are using Makefiles for Go programming (interesting / eyebrow raiser), you probably don’t have themake
program installed yet. As others have said, you can install it from https://sourceforge.net/projects/mingw/postdownload, or from a package manager like Chocolatey (see https://community.chocolatey.org/packages/make).