go20/day01/devcontainer/README.md
yumaojun03 8e9bf583c5 ```
docs(pointer): 更新指针教程文档

- 添加了图片引用
- 补充了获取用户输入的代码示例
- 增加了命令行参数解析的完整代码示例
- 完善了指针相关概念说明
```
2025-12-28 18:00:50 +08:00

31 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 使用 Dev Container 开发 demo 工程
此目录下的 `demo/` 是一个 Go 工程。已提供 VS Code Dev Container 配置,支持在容器内进行开发与调试。
### 快速开始
- 前置:本地安装 VS Code 与 Dev Containers 扩展Microsoft 提供)。
- 打开文件夹:在 VS Code 中打开 `day01/devcontainer` 目录。
- 重新在容器中打开:命令面板运行 “Dev Containers: Reopen in Container”。
- 首次启动会执行依赖下载:`postCreateCommand` 会在 `demo/` 下执行 `go mod download`
- 镜像说明:使用 `mcr.microsoft.com/devcontainers/base:ubuntu`,通过 Dev Containers Feature 安装 Go版本 1.25)。
### 容器内开发
- 代码位置:`/workspaces/<当前打开的文件夹>/demo`
- 常用操作:
- 运行:在容器终端进入 `demo/` 目录后执行 `go run main.go`
- 构建:`go build`
- 测试:`go test ./...`
- 已安装Go 工具链与 VS Code Go 扩展;保存时自动格式化与常用 lint 设置。
### 调试
- 已自动安装 Delve`dlv`)。
- VS Code 已提供调试配置:[day01/devcontainer/.vscode/launch.json](day01/devcontainer/.vscode/launch.json)
- 直接在 “Run and Debug” 视图选择 “Debug demo/main.go” 或 “Debug demo tests”。
- 断点与变量查看可在容器内正常使用。
### 备注
- 如需额外工具(如 `golangci-lint` 的安装或 `dlv` 调试器),可在 `.devcontainer/devcontainer.json` 中增加特性或 `postCreateCommand`
# devcontainer demo 工程
针对简单场景: 直接用 git bash 做完 vscode的命令工具 来使用