Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
jreisinger committed Mar 19, 2024
1 parent 9b66a8f commit ea92c3f
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 73 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

53 changes: 19 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,17 @@

# Go katas

Katas (形) are practiced in martial arts as a way to internalize the techniques
so they can be executed and adapted under different circumstances, without
thought or hesitation. Let's try the same with Go code.
Katas (形) are practiced in martial arts as a way to internalize and perfect the
techniques so they can be executed and adapted under different circumstances,
without thought or hesitation. Let's try the same with Go code.

## Why

I've been learning to program in Go. I work in the sysadmin/devops and security
areas so I don't normally get to program every day. But I still want to keep my
coding skills fresh. Maybe even improve them. I use gokatas as one of the ways
to achieve this.

## How

The approach is pretty low-tech. Go katas is basically a list of packages
(directories) that you should understand and then be rewriting from scratch
or partially. There's a command to show katas and your progress:
The approach is pretty low-tech. Go katas is a list of directories containing
brief, well written Go programs. You are supposed to try and understand them and
be rewriting them from scratch or partially. There's a command to show katas and
your progress:

```
$ go run cmd/gokatas.go -c 2
$ go run ./cmd/gokatas -c 2
Kata Last done Done Level Topics
---- --------- ---- ----- ------
boring/boring 0 days ago 1x beginner concurrency, design
Expand All @@ -31,27 +23,20 @@ areader 3 days ago 2x beginner interfaces, io.Reader
3 4x
```

It's important to practice regularly because repetition creates habits, and
habits are what enable mastery. Start by taking baby steps. Set a goal that you
can meet, e.g. 15 minutes every day before work. At first it's fine even if you
only read through one of the beginner level katas. Use documentation, a search
engine or an AI model if you don't understand something.

After some time it will require much less will power to practice. Your
programming moves will start looking simpler and smoother. If you feel
comfortable enough with a kata, stop practicing it and pick another one that
interests you and is slightly beyond your current ability.

## Initial setup
Initial setup:

1) [Install Go](https://go.dev/doc/install).

2) [Fork](https://github.com/jreisinger/gokatas/fork) and then clone the repo: `git clone [email protected]:<you>/gokatas.git`.

3) Start practicing:
3) Start practicing (remove contents from `katas.md` unless you are me :-).

```
cd gokatas
> katas.md # if you are not me :-)
go doc
```
It's important to practice regularly because repetition creates habits, and
habits are what enable mastery. Start by taking baby steps. Set a goal that you
can meet, e.g. 15 minutes every day before work. At first it's fine even if you
only read through one of the beginner level katas. Use documentation, a search
engine or an AI model if you don't understand something. After some time it will
require much less will power to practice. Your programming moves will start
looking simpler and smoother. If you feel comfortable enough with a kata, stop
practicing it and pick another one that interests you and is slightly beyond
your current ability.
2 changes: 1 addition & 1 deletion gokatas.go → cmd/gokatas/gokatas.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gokatas
package main

import (
"bufio"
Expand Down
2 changes: 1 addition & 1 deletion gokatas_test.go → cmd/gokatas/gokatas_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gokatas
package main

import (
"os"
Expand Down
6 changes: 2 additions & 4 deletions cmd/gokatas.go → cmd/gokatas/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"flag"
"log"
"os"

"github.com/jreisinger/gokatas"
)

var sortByColumn = flag.Int("c", 1, "sort katas by `column`")
Expand All @@ -24,9 +22,9 @@ func main() {
}
}

katas, err := gokatas.Get()
katas, err := Get()
if err != nil {
log.Fatalf("getting katas: %v", err)
}
gokatas.Print(katas, *sortByColumn)
Print(katas, *sortByColumn)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 0 additions & 11 deletions doc.go

This file was deleted.

0 comments on commit ea92c3f

Please sign in to comment.