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
Introduce go-mnd
Search
Tommy Mühle
February 06, 2020
Programming
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduce go-mnd
Short introduction of go-mnd, the magic number detector for Go.
Tommy Mühle
February 06, 2020
More Decks by Tommy Mühle
See All by Tommy Mühle
Useful daily business packages
tommymuehle
1
140
Enums - An introduction
tommymuehle
0
300
Defensive programming
tommymuehle
10
1.4k
Why setters are bad
tommymuehle
2
800
Keep yourself up to date
tommymuehle
0
290
Exception handling - classic and fancy
tommymuehle
3
680
Other Decks in Programming
See All in Programming
メールのエイリアス機能を履き違えない
isshinfunada
0
230
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.9k
Foundation Models frameworkで画像分析
ryodeveloper
1
600
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
200
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
870
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
2.8k
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
540
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
170
AIが無かった頃の素敵な出会いの話
codmoninc
1
400
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
460
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
480
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
210
Featured
See All Featured
Everyday Curiosity
cassininazir
0
270
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
240
GitHub's CSS Performance
jonrohan
1033
470k
Become a Pro
speakerdeck
PRO
31
6.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.3k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
520
Prompt Engineering for Job Search
mfonobong
0
400
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
270
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Transcript
Tommy Mühle | tommy-muehle.io Tommy Mühle Software Engineer and Author
1
Tommy Mühle | tommy-muehle.io Introduce go-mnd 2
Tommy Mühle | tommy-muehle.io A vet analyzer to detect magic
numbers 3
Tommy Mühle | tommy-muehle.io Magic number? 4
Tommy Mühle | tommy-muehle.io Tommy Mühle | tommy-muehle.io A magic
number is a numeric literal that is not defined as a constant, but which may change, and therefore can be hard to update. 5
Tommy Mühle | tommy-muehle.io Hide intention 6
Tommy Mühle | tommy-muehle.io Hard to change 7
package main import `github.com/google/go-github/github` func main() { var repo github.Repository
// ... if repo.GetTeamID() == 12 { // ... } } Tommy Mühle | tommy-muehle.io 8
package main import `github.com/google/go-github/github` const TeamEngineering = 12 func main()
{ var repo github.Repository // ... if repo.GetTeamID() == TeamEngineering { // ... } } Tommy Mühle | tommy-muehle.io 9
Tommy Mühle | tommy-muehle.io How it works 10
Tommy Mühle | tommy-muehle.io 11 >= 1.12
Tommy Mühle | tommy-muehle.io Supported checks 12
package main import ( "net/http" "time" ) func main() {
client := &http.Client{ Timeout: 5 * time.Second, } // ... } Tommy Mühle | tommy-muehle.io 13 Assignment
Tommy Mühle | tommy-muehle.io 14 package main import ( "fmt"
"time" ) func main() { t := time.Now() switch { case t.Hour() < 12: fmt.Println("Good morning!") default: fmt.Println("Good evening.") } } Case
package main import "net/http" func handler(w http.ResponseWriter, r *http.Request) {
// ... http.Error(w, http.StatusText(404), 404) } Tommy Mühle | tommy-muehle.io 15 Argument
package main type queue struct { // ... } //
... func (q *queue) MaxLength() int { return 500 } Tommy Mühle | tommy-muehle.io 16 Return
package main func main() { var y int // ...
x := y * 100 // ... } Tommy Mühle | tommy-muehle.io 17 Operator
Tommy Mühle | tommy-muehle.io 18 package main func main() {
var x int // ... if x > 100 { // ... } } Condition
Tommy Mühle | tommy-muehle.io Demo 19
Tommy Mühle | tommy-muehle.io 20
Tommy Mühle | tommy-muehle.io 21
Tommy Mühle | tommy-muehle.io 22
Tommy Mühle | tommy-muehle.io 22
Questions?
Thank you! Slides http:/ /bit.ly/2pTywBB @tommy_muehle