简体   繁体   English

创建一个vscode Golang package?

[英]Create a vscode Golang package?

How do I create a new Go project/module from within vscode, eg with a go.mod, etc.?如何从 vscode 中创建一个新的 Go 项目/模块,例如使用 go.mod 等?

According to the vscode Setup Overview ,根据 vscode 安装概述

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. VS Code 不包括传统的“文件”>“新建项目”对话框或预安装的项目模板。 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.借助 Yeoman 等脚手架工具和 npm package 管理器提供的大量模块,您一定会找到合适的模板和工具来创建您的项目。

Searching at the linked references revealed "new project" functionality for several languages but not for Go.搜索链接的参考资料显示了几种语言的“新项目”功能,但 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.那是因为Go没有脚手架和官方工程模板,只需要新建一个目录,从目录中打开vs code,新建一个go.mod文件(或者运行“Go:Initialize go.mod”vscode命令),新建一个go 文件。 That's it.而已。 Happy coding!编码愉快!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM