Til

Viewing Diff Since Latest Git Pull

To view the changes between your latest git pull $~ git pull origin $~ git diff @{1}.. @{n} means the n-th previous value of HEAD. You can refer the official docs on reflog Shortnames for more. p/s: I am currently trying to dissociate myself from becoming too dependent on SourceTree for daily git operations.

Go Examples and Benchmarks

I learned about Go examples and benchmarks today. They are parts of Go default package testing. Examples Go Examples are executed just like tests They are compiled and optionally executed as part of unit tests It resides in the package *_test.go files Structure func ExampleRepeat() { repeated := Repeated("x", 5) fmt.Println(repeated) // output: xxxxx } Rules Function name must be prefix with Example It must have // output: result How to Use to run the test with example, use: go test -v Sample Execution $ go test -v === RUN TestRepeat --- PASS: TestRepeat (0.