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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Tommy Mühle
February 06, 2020
Programming
0
170
Introduce go-mnd
Short introduction of go-mnd, the magic number detector for Go.
Tommy Mühle
February 06, 2020
Tweet
Share
More Decks by Tommy Mühle
See All by Tommy Mühle
Useful daily business packages
tommymuehle
1
110
Enums - An introduction
tommymuehle
0
270
Defensive programming
tommymuehle
10
1.4k
Why setters are bad
tommymuehle
2
770
Keep yourself up to date
tommymuehle
0
270
Exception handling - classic and fancy
tommymuehle
3
650
Other Decks in Programming
See All in Programming
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
150
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
280
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
3
1.9k
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
360
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
230
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
160
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
1.3k
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
430
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
290
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
390
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
470
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
340
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
140
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
240
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Bash Introduction
62gerente
615
210k
How to make the Groovebox
asonas
2
2k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
790
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
150
The Curse of the Amulet
leimatthew05
1
10k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
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