Skip to content
On this page

Go Template

Go Template 包含了多套初始化项目的模板库,在初始化项目时,会将模板库中的模板文件复制到项目中,同时会进行 CI/CD 的初始化,将项目信息同步至代码当中。

模板列表

  1. template-vite3: Vite3 模板,适用于大多数项目;
  2. template-vite2: Vite2 模板,适用于大多数项目;
  3. template-static: 静态模板,适用于不需要打包的项目;
  4. template-waibao: 外包模板,提供外包初始化项目使用;

安装模板

使用 Go CLI 安装

在使用 Go CLI 初始化项目时,会自动读取模板列表,在终端选择指定模板后,即可完成模板安装。

$ g create <project-name>

使用 NPM 安装模板

使用该方式安装模板,不会进行 CI/CD 的初始化,同时也不会记录项目信息,不推荐使用。

$ npm init @go/template --template=template-default

Released under the MIT License.