With a working computer, it’s time to figure out what I should actually do.

By day, I’m a mild-mannered (sometimes) C# dev. .NET Core is new and shiny, but I’m already playing with ASP.NET Core and MVC to build a web service, so there’s less to learn if I go a similar route on my own time.

However,  the Rust programming language is something that has caught my eye, and I’ve been looking for an excuse to play with it. That’s why I’m looking for a Rust project to contribute to.

Step 0: The Developer’s Toys

Since I’m starting to set up the computer from scratch, I get my pick of tooling.

As an editor, I will use VS Code, which is pretty nice and improving steadily. It has a well-supported set of community created extensions, including one for the Rust language.

Version control today is done with git, and since Rust lives on github and VS Code has built-in git integration, that goes on too. I don’t get to play with this at work beyond trivial local one-offs, so this is another good thing to learn.

Rust itself is installed via rustup, which installs the compiler as well as cargo, the package manager and build/test system. Cargo is also extensible with extra commands, such as one for automatically formatting source files (cargo fmt) and one for expanding macros (cargo expand, which helps figure out compilation errors, since the error diagnostics within macros is still lacking). On Windows, it also needs a linker, so I pulled in the Visual C++ build tools as well.

Step 0.5: Finding a Project

The Rust community has a weekly newsletter that lists projects looking for people to contribute on issues. The drawback is that the easy ones tend to get attention pretty quickly, so I had to hop around github until I found something: cargo wants to throw out its hand-rolled error library for the community-developed error_chain library. I already used this in my toy project at work, so I’m not going in completely blind.

Step 1: Still Not Getting Started

Before I can actually contribute, I need to sign up with github, and then volunteer to work the issue. With that social stuff out of the way, it’s time to get the source.

First order of business: in github, fork the main cargo repository into my own github account. From there, it’s off to the command line.

I git clone my online repo, and then jump through some hoops (git remote add upstream + git fetch upstream + git merge upstream/master) to make sure that I don’t fall behind as I’m working my changes. Now I can update directly from the main repository instead of having to mess with my github fork (for now).

As demanded by modern custom, I next create a new branch (git branch) for my development, and switch over (git checkout). After all this, I’m finally ready to start writing code…

Advertisements

One thought on “Forking Clones

  1. It is a lot of steps, but here’s a quick tip that’ll save you a command at the end there: git checkout -b new-branch-name. Create branch and check out in one action.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s