创建一个 vscode 的 Golang 包?

huangapple go评论84阅读模式
英文:

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!

huangapple
  • 本文由 发表于 2022年12月29日 00:11:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/74942486.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定