# goimports を Homebrew でインストール

goimports のインストール経路、実行ファイル、メタデータ、AI エージェント向けセキュリティノートを確認します。

## インストール

```sh
sudo av install brew:goimports
```

追加のインストールコマンド:

### macOS

- Homebrew (100%):

```sh
brew install goimports
```

  証拠: local Homebrew formula metadata

## パッケージ情報

- **パッケージキー:** brew:goimports
- **パッケージマネージャ:** Homebrew
- **バージョン:** 0.48.0
- **ソース概要:** Go formatter that additionally inserts import statements
- **ホームページ:** <https://pkg.go.dev/golang.org/x/tools/cmd/goimports>
- **リポジトリ:** <https://github.com/golang/tools>
- **最終更新:** 2026-07-25T20:55:24-04:00
- **生成日時:** 2026-08-03T19:37:03+00:00

## 実行可能ファイル

- goimports (エイリアス)

## インストール挙動

- Bottle: 利用不可

## バージョンと鮮度

- ページ生成日: 2026-08-03
- マネージャ版: 0.48.0
## プロジェクトの歴史と使われ方

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.

### ソース

- <https://github.com/golang/tools>
- <https://github.com/golang/tools/tree/master/cmd/goimports>
- <https://pkg.go.dev/golang.org/x/tools/cmd/goimports>


## セキュリティノート

goimports に一致するローカルシークレット処理マニフェストは見つかりませんでした。将来の対応で安定したパッケージ URL を使えるよう、Nucleus パッケージメタデータはここに公開されています。



## 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: $GOPATH/src/.goimportsignore

## Combined YAML source

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


## ソース

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- cross-ecosystem install command graph
