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
790
命名をリントする
2024/12/15 Kyoto.go #56 で発表した資料です。
chiroruxx
December 15, 2024
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
Go Connectへの想い
chiroruxx
0
170
eBPF with PHPをさわる
chiroruxx
0
120
sl完全に理解したつもり
chiroruxx
0
110
良い命名かを調べるリンターを作った + α
chiroruxx
0
110
GoLandを布教する会
chiroruxx
0
37
PHPはいつから死んでいるかの調査
chiroruxx
3
650
元phperから見たGoの良いところ
chiroruxx
0
94
Go Connectへの想い
chiroruxx
0
480
GraphQLに入門してみた
chiroruxx
2
350
Other Decks in Programming
See All in Programming
状態遷移図を書こう / Sequence Chart vs State Diagram
orgachem
PRO
2
200
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
220
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
360
MCPを使ってイベントソーシングのAIコーディングを効率化する / Streamlining Event Sourcing AI Coding with MCP
tomohisa
0
170
CDK引数設計道場100本ノック
badmintoncryer
2
480
Deep Dive into ~/.claude/projects
hiragram
14
14k
SQLアンチパターン第2版 データベースプログラミングで陥りがちな失敗とその対策 / Intro to SQL Antipatterns 2nd
twada
PRO
11
1.3k
DMMを支える決済基盤の技術的負債にどう立ち向かうか / Addressing Technical Debt in Payment Infrastructure
yoshiyoshifujii
3
410
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
99
37k
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
3
1.1k
型で語るカタ
irof
0
700
ご注文の差分はこちらですか? 〜 AWS CDK のいろいろな差分検出と安全なデプロイ
konokenj
3
580
Featured
See All Featured
Embracing the Ebb and Flow
colly
86
4.8k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Into the Great Unknown - MozCon
thekraken
40
1.9k
Fireside Chat
paigeccino
37
3.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Navigating Team Friction
lara
187
15k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
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 だが、開発者が定義してない 細かく見ていく必要がある