Automic VaultAutomic Vault

brew

使用 Homebrew 安装 goimports

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

安装

其他安装命令

macOS

Homebrew已验证 · 100%
brew install goimports

local Homebrew formula metadata

概览

软件包摘要

Go formatter that additionally inserts import statements

命令和别名

  • goimports

历史

项目历史与用法

goimports is a Go formatter command that also adds missing imports and removes unused imports. It is part of golang.org/x/tools, the official Go supplementary tools repository.

The command became one of the canonical editor-save tools in Go development because it turns source formatting and import maintenance into one operation.

项目历史

The cmd/goimports documentation carries a 2013 Go Authors copyright notice, and repository history records goimports moving into go.tools in December 2013. Soon after, the README was renamed to doc.go, making the command documentation part of the source package.

The implementation evolved alongside Go tooling: repository history shows work on package lookup, standard-library handling, cgo exports, vendor directory support, and module-era behavior. The command remains documented through both its source directory and pkg.go.dev.

采用历史

goimports was adopted through editors as much as through terminals. The official command docs include examples for Emacs and Vim, telling users to make goimports their format-on-save command.

Because it lives in x/tools rather than the core go command, goimports is a classic package-manager/editor dependency: small binary, official upstream, and installed wherever developers want import organization without manually editing import blocks.

使用方式

The documented install path uses go install for golang.org/x/tools/cmd/goimports. In use, it formats code like gofmt and rewrites imports based on symbols in the file.

goimports respects $GOPATH/src/.goimportsignore, a line-oriented ignore file for directories that should not be scanned when resolving packages under GOPATH. That file is the only official fixed config-file location documented by the command.

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

goimports matters because it is the bridge between Go's no-bikeshedding formatting culture and the messier reality of import discovery. It made save hooks feel magical without requiring a full IDE.

For packagers, it is an example of an official subcommand distributed from a larger module. The package name is the command, but the upstream repository and release cadence are tied to golang.org/x/tools.

时间线

  • 2013: goimports moves into go.tools and command documentation becomes doc.go.
  • 2014: Repository history records import lookup, standard-library, cgo, and golang.org/x path work.
  • 2016: Vendor directory support lands in the imports package.
  • 2016: .goimportsignore support is added for excluding GOPATH directories from scans.
  • 2026: x/tools history continues to update imports behavior for module cache and tooling changes.

Related projects

  • gofmt is the formatter behavior goimports preserves while adding import management.
  • golang.org/x/tools is the official repository that contains cmd/goimports and the imports package.
  • gopls overlaps with goimports in editor workflows by providing language-server driven formatting and import organization.

安全态势

尚未找到受保护工具覆盖

没有找到 goimports 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布,以便未来覆盖拥有稳定的软件包 URL。

安装行为

  • formula 元数据中未记录 Homebrew post-install 钩子。
  • Homebrew bottle 元数据适用于 6 个平台目标。
  • 安装时包含 1 个运行时依赖。

建议审查

在无人值守的代理使用前,请检查该工具是否读取明文凭据、写入远程状态、发布制品或调用插件。

local files

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

Config paths the tool may read or write during local use.

Unix
$GOPATH/src/.goimportsignore

可执行文件

已安装的可执行文件

命令类型暴露范围备注
goimportscli全局可执行文件

新鲜度

版本和新鲜度

这些信号区分页生成时间、软件包管理器活动和上游发布比较。只有存在证据 URL 和可比较版本时,才会提示版本落后。

页面生成时间2026-07-10
管理器版本0.48.0
管理器更新时间2026-07-09
本地数据OK
上游当前
检测到的最新版本v0.48.0

https://github.com/golang/tools

  • OK没有生成新鲜度警告。

安装元数据

软件包元数据

软件包键brew:goimports
版本0.48.0
软件包管理器Homebrew
软件包管理器页面https://formulae.brew.sh/formula/goimports
主页https://pkg.go.dev/golang.org/x/tools/cmd/goimports
仓库https://github.com/golang/tools
上游文档https://github.com/golang/tools/tree/master/cmd/goimports
许可证BSD-3-Clause
源码归档https://github.com/golang/tools/archive/refs/tags/v0.48.0.tar.gz
最后更新2026-07-09T08:38:20Z
Pulseupdated
依赖go
Bottle可用 (于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux)
Homebrew post-install未定义
服务未声明

注册表事实

源数据库详情

Source DatabaseHomebrew formula API
Taphomebrew/core
Full Namegoimports
Version Scheme0
Revision0
Head VersionHEAD
Bottle Stable Root URLhttps://ghcr.io/v2/homebrew/core
Deprecatedno
Disabledno
Keg Onlyno
URL Keys
  • head
  • stable

来源线索

由仓库数据生成

此页面由 av-webscripts/generate-pkg-sqlite.py 生成的私有软件包 SQLite 工件提供。

使用的来源

  • Geiger risk classifier
  • Nucleus package database
  • av.db category and tag curation
  • cross-ecosystem install command graph
  • curated configuration and credential file locations
  • curated package history
  • package relationship graph
  • package version freshness
  • package-page enrichment