Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
命名をリントする
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
Transcript
25 slides
命名をリントする 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 だが、開発者が定義してない 細かく見ていく必要がある
More Decks by chiroruxx
See All by chiroruxx
Contextとはなにか
chiroruxx
1
530
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
170
Laravelのパッケージ全部紹介する
chiroruxx
2
220
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
65
PHPをGoで動かす
chiroruxx
0
130
Goを使ってTDDを体験しよう!
chiroruxx
1
1.5k
今ならできる!PhpStormプラグイン開発
chiroruxx
0
140
Go Connectへの想い
chiroruxx
0
250
eBPF with PHPをさわる
chiroruxx
0
220
Other Decks in Programming
See All in Programming
Seven New Principles of Software Engineering
yegor256
0
500
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
330
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
6k
あなたはMCPの機能を、まだ知らない。
4geru
1
140
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
310
Performance Optimization With LLMs
xleitix
0
260
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
2
430
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
2.1k
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
200
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
210
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
180
Crash Auto Pipelines
veronikapj
1
420
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
610
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
610
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Agile that works and the tools we love
rasmusluckow
331
22k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380
The untapped power of vector embeddings
frankvandijk
2
2k
How GitHub (no longer) Works
holman
316
150k
We Are The Robots
honzajavorek
0
440
ラッコキーワード サービス紹介資料
rakko
5
5.8M
Bootstrapping a Software Product
garrettdimon
PRO
306
120k