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
860
命名をリントする
2024/12/15 Kyoto.go #56 で発表した資料です。
chiroruxx
December 15, 2024
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
Goを使ってTDDを体験しよう!
chiroruxx
1
590
今ならできる!PhpStormプラグイン開発
chiroruxx
0
57
Go Connectへの想い
chiroruxx
0
190
eBPF with PHPをさわる
chiroruxx
0
130
sl完全に理解したつもり
chiroruxx
0
120
良い命名かを調べるリンターを作った + α
chiroruxx
0
130
GoLandを布教する会
chiroruxx
0
45
PHPはいつから死んでいるかの調査
chiroruxx
3
680
元phperから見たGoの良いところ
chiroruxx
0
110
Other Decks in Programming
See All in Programming
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
250
Introducing RemoteCompose: break your UI out of the app sandbox.
camaelon
2
390
Developer Joy - The New Paradigm
hollycummins
1
400
CSC509 Lecture 11
javiergs
PRO
0
280
社会人になっても趣味開発を続けたい! / traPavilion
mazrean
1
120
When Dependencies Fail: Building Antifragile Applications in a Fragile World
selcukusta
0
120
iOSでSVG画像を扱う
kishikawakatsumi
0
180
品質ワークショップをやってみた
nealle
0
870
AsyncSequenceとAsyncStreamのプロポーザルを全部読む!!
s_shimotori
1
220
AI Agent 時代的開發者生存指南
eddie
4
2.3k
Towards Transactional Buffering of CDC Events @ Flink Forward 2025 Barcelona Spain
hpgrahsl
0
120
Temporal Knowledge Graphで作る! 時間変化するナレッジを扱うAI Agentの世界
po3rin
5
1.1k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
640
Faster Mobile Websites
deanohume
310
31k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Java REST API Framework Comparison - PWX 2021
mraible
34
8.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.5k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
A better future with KSS
kneath
239
18k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
44
8k
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 だが、開発者が定義してない 細かく見ていく必要がある