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.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
命名をリントする
2024/12/15 Kyoto.go #56 で発表した資料です。
chiroruxx
December 15, 2024
More Decks by chiroruxx
See All by chiroruxx
Contextとはなにか
chiroruxx
1
390
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
130
Laravelのパッケージ全部紹介する
chiroruxx
2
140
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
48
PHPをGoで動かす
chiroruxx
0
100
Goを使ってTDDを体験しよう!
chiroruxx
1
1.1k
今ならできる!PhpStormプラグイン開発
chiroruxx
0
110
Go Connectへの想い
chiroruxx
0
220
eBPF with PHPをさわる
chiroruxx
0
190
Other Decks in Programming
See All in Programming
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
200
1B+ /day規模のログを管理する技術
broadleaf
0
130
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
250
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
150
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
240
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
570
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
2
240
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
180
Vite+ Unified Toolchain for the Web
naokihaba
0
710
OSINT for SRE: 学術論文とポストモーテムから探る システム障害の共通パターン / SRE NEXT 2026
tomoyk
1
2.7k
act1-costs.pdf
sumedhbala
0
180
AIエージェントで 変わるAndroid開発環境
takahirom
2
460
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
180
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
180
Product Roadmaps are Hard
iamctodd
55
12k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
390
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.5k
Speed Design
sergeychernyshev
33
1.9k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
500
Ethics towards AI in product and experience design
skipperchong
2
320
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 だが、開発者が定義してない 細かく見ていく必要がある