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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
120
Claude Code Skill入門
mayahoney
0
420
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
180
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
240
AI 開発合宿を通して得た学び
niftycorp
PRO
0
160
モダンOBSプラグイン開発
umireon
0
170
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
570
PHPで TLSのプロトコルを実装してみる
higaki_program
0
400
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
1.1k
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
360
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
300
Windows on Ryzen and I
seosoft
0
360
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
150
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.2k
Un-Boring Meetings
codingconduct
0
230
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
270
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