{"id":44437137,"url":"https://github.com/fsgo/smart-go-dl","last_synced_at":"2026-02-12T14:01:03.449Z","repository":{"id":57647661,"uuid":"443357794","full_name":"fsgo/smart-go-dl","owner":"fsgo","description":"Multi Go version management","archived":false,"fork":false,"pushed_at":"2025-11-17T10:28:01.000Z","size":2525,"stargazers_count":79,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-17T12:06:32.002Z","etag":null,"topics":["go","go-dl","golang","golang-dl","multi-go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fsgo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-12-31T14:00:46.000Z","updated_at":"2025-11-17T10:26:27.000Z","dependencies_parsed_at":"2025-07-12T20:00:44.292Z","dependency_job_id":null,"html_url":"https://github.com/fsgo/smart-go-dl","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/fsgo/smart-go-dl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fsmart-go-dl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fsmart-go-dl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fsmart-go-dl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fsmart-go-dl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fsgo","download_url":"https://codeload.github.com/fsgo/smart-go-dl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fsmart-go-dl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29367808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","go-dl","golang","golang-dl","multi-go"],"created_at":"2026-02-12T14:00:46.169Z","updated_at":"2026-02-12T14:01:03.442Z","avatar_url":"https://github.com/fsgo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smart-go-dl\nGo 多版本管理辅助工具, 可以快速安装 Go ( 次要版本 ) 的最新版本，并对过期版本进行清理。  \n\n使用 https://github.com/golang/dl 以获取 Go 版本列表。\n\n依赖：\n 1. 需要设置环境变量 `$GOBIN`，可参考如下进行配置：\n```bash\nexport GOBIN=$HOME/go/bin   # go install 安装的二进制文件所在目录，go1.x命令也将安装到此目录\n\nexport PATH=$GOBIN:$PATH    # 可以直接在任意位置使用 GOBIN 目录下的所有命令\n```\n\n## 安装/更新\n未安装过 Go 的，请先在 https://go.dev/dl/ 下载安装 Go，\n若非 windows 系统(如 Linux \u0026 mac )，也可以直接 [下载编译好的二进制文件](https://github.com/fsgo/smart-go-dl/releases) 。\n\n已安装过 Go ，安装和更新：\n```bash\ngo install github.com/fsgo/smart-go-dl@latest\n```\n\n\n## 查看使用帮助\n```bash\nsmart-go-dl -help\n```\n\n## 安装 Go SDK\n### 安装 `go1.25` 的最新版本：\n```bash\nsmart-go-dl install go1.25\n```\n会自动找到`go1.25` 最新的版本进行安装，并安装为 `$GOBIN/go1.25.0` 和 `$GOBIN/go1.25`。  \n如当前 go1.25 的最新版本是 `go1.25.5`，则上述 `$GOBIN/go1.22` 是 `$GOBIN/go1.22.5` 的软连接。  \n\n安装或更新后，会创建软连 `$GOBIN/go.latest`，其为当前安装的最新版本。\n若 `$GOBIN/go` 不存在，则也会创建这个软连接，相当于 `ln -s go.latest go`,即这个 `$GOBIN/go`总是最新版本的 go。\n\n在使用的时候，可以直接使用 `go`、`go.latest`、`go1.25`、`go1.25.0` 之一：\n```bash\n# go1.25 version\n或者\n# go1.25.0 version\n或者\n# go version\n```\n输出：\n```\ngo version go1.25.0 darwin/amd64\n```\n\n以后有新的版本了，重新使用 `smart-go-dl install/update go1.25` 即可安装最新版本。\n\n使用其他版本示例：\n```\ngo1.22.0 version       # 使用首个正式版本，对应版本号为 go1.22.0\ngo1.22.1 version       # 使用第 1 个正式修正版本,对应版本号为 go1.22.1\ngo1.22.2 version       # 使用第 2 个正式修正版本,对应版本号为 go1.22.2\n```\n### 安装指定的 3 位版本：\n```bash\nsmart-go-dl install go1.22.5\n```\n### 安装首个正式版本\nGo 的每个正式版本是如 `go1.22` 这种，3 位版本号 0 是缺省的，若要安装，可以这样：\n```bash\nsmart-go-dl install go1.22.0\n```\n之后这样使用，如 `go1.22.0 version` 。\n\n\n## 清理过期的 Go SDK\n将 `go1.21` 除了最新版本的老版本清理掉：\n```bash\nsmart-go-dl clean go1.21\n```\n\n若期望指定版本不被清理，可以使用子命令 `lock`，如下为让 `go1.22.3`这个版本不被清理：\n```bash\nsmart-go-dl lock go1.22.3\n```\n于此对应的有 `unlock` 命令，用于解除 lock 状态。\n\n## 更新 Go SDK\n```bash\nsmart-go-dl update go1.22\n```\n等价于先执行 clean，再执行 install。  \n还可以使用`smart-go-dl update` 来更新所有已安装版本( gotip 除外 )。\n\n\n## 列出已安装/可安装的 Go SDK\n```bash\nsmart-go-dl list\n```\n\n输出：\n```\n--------------------------------------------------------------------------------\nversion              latest               installed\n--------------------------------------------------------------------------------\ngotip                gotip\ngo1.23               go1.23rc2\ngo1.22               go1.22.5             go1.22.5\ngo1.21               go1.21.12\ngo1.20               go1.20.14\ngo1.19               go1.19.13\ngo1.18               go1.18.10\ngo1.17               go1.17.13\ngo1.16               go1.16.15\ngo1.15               go1.15.15\ngo1.14               go1.14.15\ngo1.13               go1.13.15\ngo1.12               go1.12.17\ngo1.11               go1.11.13\ngo1.10               go1.10.8\ngo1.9                go1.9.7\ngo1.8                go1.8.7\ngo1.7                go1.7.6\ngo1.6                go1.6.4\ngo1.5                go1.5.4\n[smart-go-dl] list success\n```\n\n第一列，若是绿色，说明当前已按照最新版本，若是黄色，安装的不是最新版本。    \nwindows 环境下目前未做终端颜色的适配。  \n\n## 删除指定版本的 Go SDK\n```bash\nsmart-go-dl remove go1.19.1\n```\n\n## 配置文件\n可选的配置文件为 `~/.config/smart-go-dl/app.toml`:\n```toml\n# 下载时使用的 Proxy，可选\n# 不配置或者为空时，会使用环境变量的代理配置\n# Proxy=\"http://127.0.0.1:8128\"\n\n# 下载文件时，是否跳过证书校验，可选，默认 false\n# InsecureSkipVerify = true\n\n# 下载 Go tar 文件的地址前缀，可选\n# 会一次使用每个地址进行尝试\n# 默认值是 \"https://dl.google.com/go/,https://dl-ssl.google.com/go/\"\n#TarURLPrefix=\"https://dl.google.com/go/\"\n\n# 安装目录，可选，默认为 ~/sdk\n# 不同的 Go 版本在 SDKDir 中以子目录方式存在，如 ~/sdk/go1.22.0/\n# SDKDir = \"\"\n```\n该文件在不存在的时候，会尝试自动创建\n\n## 数据/缓存目录\n该程序使用 `${SDKDir}/smart-go-dl/` 目录缓存数据，依赖的 https://github.com/golang/dl \n也会自动下载到此目录下的 `golang_dl` 子目录中。  \n首次使用时会使用 `git clone` 命令下载 `golang_dl`，之后会使用 `git pull` 命令检查更新。  \n因 golang_dl 更新频率很低，也为了使用 `smart-go-dl` 时更流畅，更新时间间隔在 1 分钟内，\n再次使用时不会使用 `git pull` 检查更新。  \n若因为某些原因，git 命令下载和更新不能正常工作，也可以手工创建和更新该目录。\n\n\n## 自动版本选择\n在不同目录，执行 go 命令，使用不同的 go 版本：  \nhttps://github.com/fsgo/bin-auto-switcher","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsgo%2Fsmart-go-dl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffsgo%2Fsmart-go-dl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsgo%2Fsmart-go-dl/lists"}