Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
命名をリントする
Search
chiroruxx
December 15, 2024
Programming
1
960
命名をリントする
2024/12/15 Kyoto.go #56 で発表した資料です。
chiroruxx
December 15, 2024
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
100
Laravelのパッケージ全部紹介する
chiroruxx
2
87
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
22
PHPをGoで動かす
chiroruxx
0
76
Goを使ってTDDを体験しよう!
chiroruxx
1
850
今ならできる!PhpStormプラグイン開発
chiroruxx
0
75
Go Connectへの想い
chiroruxx
0
200
eBPF with PHPをさわる
chiroruxx
0
150
sl完全に理解したつもり
chiroruxx
0
140
Other Decks in Programming
See All in Programming
AI巻き込み型コードレビューのススメ
nealle
2
1.7k
Premier Disciplin for Micro Frontends Multi Version/ Framework Scenarios @OOP 2026, Munic
manfredsteyer
PRO
0
120
生成AIを活用したソフトウェア開発ライフサイクル変革の現在値
hiroyukimori
PRO
0
110
dchart: charts from deck markup
ajstarks
3
1k
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
150
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
180
ノイジーネイバー問題を解決する 公平なキューイング
occhi
0
110
Sekiban + Microsoft Orleans のアクターをAWS対応しました / Sekiban + Microsoft Orleans actors are now supported on AWS.
tomohisa
0
100
Head of Engineeringが現場で回した生産性向上施策 2025→2026
gessy0129
PRO
0
120
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
120
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
160
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
640
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Navigating Weather and Climate Data
rabernat
0
110
Done Done
chrislema
186
16k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
180
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
Building Adaptive Systems
keathley
44
2.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.6k
Building AI with AI
inesmontani
PRO
1
720
A Soul's Torment
seathinner
5
2.3k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
410
Transcript
命名をリントする 2024/12/15 Kyoto.go #56
自己紹介 ちひろ 株式会社モリサワ X: @chiroruxxxx
1年をカンファレンスに 例えるなら
年末のLTは
懇親会LTのような ものですよね!?!?
ということで 明日からすぐに役に立たない! 身にならない話をします!
本題
命名をリントする 2024/12/15 Kyoto.go #56
良い命名とは 観点は色々とある 時間をかけ、一生懸命考えた命名は良い命名かもしれない 人生の中で、一番命名を気にしているタイミングがどこだろ う
良い命名とは 子どもの名付け
子どもの 名付け 子どもの名づけも、色々な観点がある 言葉の意味 子どもがどうなってほしいか よびやすさ・語感
周りから浮かないか 画数
画数占い 赤ちゃん命名ガイド
つまり
良い命名とは 良い画数の命名 かもしれない?
命名と画数 画数の良い命名を変数にすれば その変数が起因のバグが起こらない かもしれない?
われわれは 画数をチェックする 必要がある! ということでつくりました
作ったよ https://github.com/chiroruxx/lucky-lint-go go vet で動くよ 以下の命名に対応
変数・定数の宣言・代入 型 フィールド名 関数名 パッケージのエイリアス名
ドメイン部分 「ローマ字の姓名判断・商品名画数」を参考に https://meimeimaker.com/articles/strokes-alphabet.php
ドメイン部分 「ローマ字の姓名判断・商品名画数」を参考に https://meimeimaker.com/articles/strokes-alphabet.php
こんなかんじ
まとめ 良い画数の名前を選ぼう! CIでリンターをまわしてチェックすれば安全だね!
その他細かい話 時間があれば
予約語 予約語の命名は開発者がどうにもできないので除外 変数名の _ (アンダーバー) 関数名の
main init ドットインポート
慣用的な名前 変数名の ok, err メソッドのレシーバ名 1文字にすることが多いが、1文字はたいてい良い画数ではない
見るべき ノード asciicheck では、ast.Ident のみを対象としている ast.Ident を対象とすると、自分の定義していない命名も 見てしまう
例えば Printf は ast.Ident だが、開発者が定義してない 細かく見ていく必要がある