# 使用 Homebrew, zypper 安装 swag

查看 swag 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:swag
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install swag
```

  证据: local Homebrew formula metadata

### Linux

- zypper (92%):

```sh
sudo zypper install swag
```

  证据: openSUSE Tumbleweed package metadata: swag from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:swag
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/swag>
- **版本:** 1.16.6
- **来源摘要:** Automatically generate RESTful API documentation with Swagger 2.0 for Go
- **主页:** <https://github.com/swaggo/swag>
- **仓库:** <https://github.com/swaggo/swag>
- **许可证:** MIT
- **源码归档:** <https://github.com/swaggo/swag/archive/refs/tags/v1.16.6.tar.gz>
- **最后更新:** 2026-07-26T04:03:48+02:00
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- swag (cli)
- swag (别名)

## 构建依赖

- go

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 1.16.6
- 管理器更新时间: 2026-07-26
- 本地数据: OK
- 上游仓库: https://github.com/swaggo/swag
- 检测到的最新版本: v1.16.6 (当前)
## 项目历史与用法

swag is the Swaggo command-line generator for producing Swagger 2.0 documentation from Go source-code annotations. It became a common Go ecosystem tool because it lets web services generate API docs without leaving the Go build and source layout.

### 项目历史

The swaggo/swag repository was created on GitHub in June 2017. Its README says Swag converts Go annotations to Swagger Documentation 2.0 and provides plugins for popular Go web frameworks so generated output can be served through Swagger UI.

### 采用历史

The project reached a v1.0.0 release in November 2017 and continued through the v1.x line while publishing binaries, a Docker image, and `go install` instructions. The README lists integrations for Gin, Echo, Buffalo, net/http, gorilla/mux, chi, Fiber, Hertz, and other Go web stacks.

### 使用方式

The standard workflow is to add declarative comments to Go handlers, install the `swag` command, and run `swag init` at the project root. The CLI then writes a docs package plus swagger.json and swagger.yaml outputs, with flags for alternate entry files, output directories, parse depth, dependency parsing, and global overrides via `.swaggo`.

### 为什么软件包爱好者会关心

swag is package-nerd relevant because it turns API documentation generation into a reproducible build step for Go projects. Distributions and developer package managers care about it as a standalone CLI, while Go users care that the same tool can be installed as a binary, Docker image, or module-aware `go install` target.

### 时间线

- 2017: GitHub repository created.
- 2017: v1.0.0 tag published.
- 2025: v1.16.6 released in the continuing v1 line.
- 2026: v2.0.0 release candidates listed in GitHub releases during research.

### Related projects

- The README points to companion Swagger UI middleware packages such as swaggo/gin-swagger, swaggo/echo-swagger, swaggo/files, and swaggo/http-swagger.

### 来源

- <https://api.github.com/repos/swaggo/swag>
- <https://api.github.com/repos/swaggo/swag/releases>
- <https://github.com/swaggo/swag#readme>
- source_facts.package-manager


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: .swaggo
## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** swag
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## 其他软件包管理器记录

- zypper - swag - 1.16.6-1.7: normalized package name match | openSUSE Tumbleweed package metadata: swag from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Automatically generate RESTful API documentation with Swagger 2.0 for Go | https://github.com/swaggo/swag


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/zh-hans/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://pkg.so/zh-hans/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [go](https://pkg.so/zh-hans/brew/go/) - Build dependency declared by Homebrew.
- [swagger-codegen](https://pkg.so/zh-hans/brew/swagger-codegen/) - Shares pkgdb curated category or tags: cli, developer-tools, openapi, swagger.
- [redocly-cli](https://pkg.so/zh-hans/brew/redocly-cli/) - Shares pkgdb curated category or tags: api-documentation, cli, developer-tools, openapi.
- [vacuum](https://pkg.so/zh-hans/brew/vacuum/) - Shares pkgdb curated category or tags: cli, developer-tools, openapi, swagger.
- [autorest](https://pkg.so/zh-hans/brew/autorest/) - Shares pkgdb curated category or tags: cli, developer-tools, openapi, swagger.
- [swagger2markup-cli](https://pkg.so/zh-hans/brew/swagger2markup-cli/) - Shares pkgdb curated category or tags: cli, developer-tools, openapi, swagger.
- [fzf](https://pkg.so/zh-hans/brew/fzf/) - Shares pkgdb curated category or tags: cli, developer-tools, go.
- [hugo](https://pkg.so/zh-hans/brew/hugo/) - Shares pkgdb curated category or tags: cli, developer-tools, go.
- [golangci-lint](https://pkg.so/zh-hans/brew/golangci-lint/) - Shares pkgdb curated category or tags: cli, developer-tools, go.
- [apib2swagger](https://pkg.so/zh-hans/npm/apib2swagger/) - Local package facts share a topical domain. Shared terms: api, cli, developer, developer-tools, generate.
- [widdershins](https://pkg.so/zh-hans/npm/widdershins/) - Local metadata places this package in an adjacent workflow. Shared terms: api, cli, developer, developer-tools, documentation.
- [fastify-openapi-glue](https://pkg.so/zh-hans/npm/fastify-openapi-glue/) - Local package facts share a topical domain. Shared terms: api, cli, developer, developer-tools, generate.

## Combined YAML source

View the package source record on GitHub. [combined/swag.yml](https://github.com/mxcl/pkgdb/blob/main/combined/swag.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
