How to Skip Long Running Test in Go

Here’s a quick tip on how to skip long running tests in Go. In your test function that you want to skip, add a t.Short() boolean check. For example: func TestLongRunning(t *testing.T) { if t.Short() { t.Skip("skip long running test") } // tests that will take a while to run ... } Then when you run go test, simply provide a -short flag to skip the test. For example:

How To Enable Go Fmt On Save In GoLand

One thing I miss when switching from VS Code to GoLand is the ability to auto-format the code with go fmt when saving the files. You need to navigate to Tools > Go Tools > Go Fmt Project to run it, or use the keyboard shortcut which is ⌥⇧⌘P. Still, this is something that you can easily forget to run every single time. Luckily, GoLand have built in file watchers that you can use to run go fmt every time there’s a file changes.

Go Delve Debugger Issue On macOS Catalina

I started using GoLand yesterday after hearing good things about it from my friends who is doing Go development. When I try to use the GoLand’s debugger, I got the following error; could not launch process: debugserver or lldb-server not found: install XCode’s command line tools or lldb-server How Do I Fix It? When I googled, it seems this issue is more related to Delve, the debugger for Go and macOS Catalina.

Using Xcode 11's Swift Package Manager in Your Project

Similar like Cocoapods or Carthage, you can use Swift Package Manager to manage the dependencies in your Cocoa project. With the latest Xcode 11, there is now a native support for Swift Package Manager for you to use it directly in your project. Adding a new package To add a new package with Swift Package Manager is really easy. Go to the following Xcode’s menu: File > Swift Packages > Add Package Dependency.

Keep Test Logic out of Production

I’m currently reading xUnit Test Patterns: Refactoring Test code and so far it’s been a great read. Here’s some advices on keeping the test logic out of production code. Don’t. Testing is about verifying the behavior of a system. If the system behaves differently when under test, then how can we be certain that the production code actually works? The production code should not contain any conditional statements of the if testing then sort.

Understanding LLDB Contexts in Xcode

Sometimes when debugging on Xcode with LLDB’s p or po, it will throw a syntax error at you and you might be wondering out why? You checked for any typos but everything seems to be correct. So what gives? Well, that’s because you might be using it in the wrong context. Here’s a quick rundown: When you stop in Objective-C code using breakpoint, LLDB will use Objective-C debugging context.

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

How to Change Git Branch Name

A quick one. Here’s how to change your git branch name: If you want to rename of your current local branch: git branch -m new-branch-name If you want to change the name of a different local branch git branch -m old-branch new-branch-name That’s it. Bye.