Useful XCTest Keyboard Shortcuts

Here are some helpful keyboard shortcuts that can help you run your unit tests much more quickly To run all tests: CMD + U To run whichever test your text caret (those blinking thing) is currently in: CTRL + Alt + CMD + U To run the last test that you have ran: CTRL + Alt + CMD + G

Using Go Dep to Manage Dependencies

dep is a dependency management tool for golang. If you have done any software development before, dep is similar to npm, pod or pip. In simple words, it is a package manager to manage your project’s third party libraries. How to install it There’s a few ways to install dep. Personally I prefer to install it with Homebrew $~ brew install dep Initializing a project with dep To initialize it in your go project, go to your project directory and run the following

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.