[[Go]]で望ましい[[パッケージ (Go)|パッケージ]]構成についてまとめる。
基本的には[[📚Standard Go Project Layout]]に従えばよい。日本語版がせっかく用意されているのでそちらを参考に。古いかもだけど。
<div class="link-card">
<div class="link-card-header">
<img src="https://github.githubassets.com/favicons/favicon.svg" class="link-card-site-icon"/>
<span class="link-card-site-name">GitHub</span>
</div>
<div class="link-card-body">
<div class="link-card-content">
<div>
<p class="link-card-title">project-layout/README_ja.md at master · golang-standards/project-layout</p>
</div>
<div class="link-card-description">
Standard Go Project Layout. Contribute to golang-standards/project-layout development by creating an...
</div>
</div>
<img src="https://opengraph.githubassets.com/5949d6e1d0d9c928332f38ebe7257624f2d889412727b83f4484493512625fe5/golang-standards/project-layout" class="link-card-image" />
</div>
<a href="https://github.com/golang-standards/project-layout/blob/master/README_ja.md"></a>
</div>
## 基本
- 特別な理由がなければ[[モジュール (Go)|モジュール]]を利用する
- 開発初期段階でこのレイアウトに従うのはやりすぎ (`main.go`があればとりあえずOK)
- 公式の見解ではなくコミュニティによって定義されたもの
- ==`src`ディレクトリを作ってはいけない==