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
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
130
Enums - An introduction
tommymuehle
0
290
Defensive programming
tommymuehle
10
1.4k
Why setters are bad
tommymuehle
2
790
Keep yourself up to date
tommymuehle
0
280
Exception handling - classic and fancy
tommymuehle
3
670
Other Decks in Programming
See All in Programming
Creating Composable Callables in Contemporary C++
rollbear
0
150
RTSPクライアントを自作してみた話
simotin13
0
620
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
370
Oxlintのカスタムルールの現況
syumai
6
1.1k
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
140
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.3k
AIで効率化できた業務・日常
ochtum
0
140
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.3k
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
200
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
310
dRuby over BLE
makicamel
2
380
Webフレームワークの ベンチマークについて
yusukebe
0
170
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
200
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
250
How to make the Groovebox
asonas
2
2.2k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
270
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Automating Front-end Workflow
addyosmani
1370
210k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
170
How to train your dragon (web standard)
notwaldorf
97
6.7k
Evolving SEO for Evolving Search Engines
ryanjones
0
220
Faster Mobile Websites
deanohume
310
32k
Utilizing Notion as your number one productivity tool
mfonobong
4
320
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