英文:
Create a vscode Golang package?
问题
如何在 vscode 中创建一个新的 Go 项目/模块,例如带有 go.mod 等?
根据 vscode 的设置概述,
如何创建和运行一个新项目?
VS Code 不包含传统的“文件 > 新建项目”对话框或预安装的项目模板。您需要根据您的开发兴趣添加额外的组件和脚手架工具。通过像 Yeoman 这样的脚手架工具和通过 npm 包管理器提供的众多模块,您肯定能找到适合的模板和工具来创建您的项目。
在链接的参考文档中搜索发现了几种语言的“新项目”功能,但没有针对 Go 的。
英文:
How do I create a new Go project/module from within vscode, e.g. with a go.mod, etc.?
According to the vscode Setup Overview,
> How do I create and run a new project?
> VS Code doesn't include a traditional File > New Project dialog or pre-installed project templates. You'll need to add additional components and scaffolders depending on your development interests. With scaffolding tools like Yeoman and the multitude of modules available through the npm package manager, you're sure to find appropriate templates and tools to create your projects.
Searching at the linked references revealed "new project" functionality for several languages but not for Go.
答案1
得分: 2
这是因为Go语言没有脚手架或官方项目模板。只需创建一个目录,从该目录中打开VS Code,创建一个go.mod文件(或运行"Go: Initialize go.mod" VS Code命令),然后创建一个新的go文件。就这样,愉快地编码吧!
英文:
That's because there are no scaffolding or official project templates for Go.
Just create a directory, open vs code from the directory, create a go.mod file (or run "Go: Initialize go.mod" vscode command), and create a new go file. That's it. Happy coding!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论