⚽ Goals

I started today with two goals:

  • Learn more about the net package by adding examples
  • Submit my first contribution

✨ And I completed both!!!

🔎 Finding where to contribute

Some functions in golang docs have examples. These examples are written as tests in the actual code. I figure writing examples will (1) be a good first contribution to make sure I understand the non-github workflow and make sure I signed the CLA properly and (2) be a good way to learn more about the net package.

I looked through the net package docs and saw that the IP section was lacking a lot of examples. So I started there!

⚙️ IP Functions

I ended up writing examples for the following 14 functions:

  • Equal
  • IsGlobalUnicast
  • IsInterfaceLocalMulticast
  • IsLinkLocalMulticast
  • IsLinkLocalUnicast
  • IsLoopback
  • IsMulticast
  • IsPrivate
  • IsUnspecified
  • MarshalText
  • String
  • To16
  • To4
  • UnmarshalText

I spent a lot of time trying to make the examples look as clean as possible.

👩‍💻 IP Learnings

While writing these examples I had to do some googling. Like “what is a global unicast IP?” and “What is a link local multicast IP?”. I watched these two videos “IPv6 Global Unicast Address by Rick Graziani” and “IPv6 Basics for Beginners by danscourses”. I ended up learning a lot about IPv6.

Before today I thought ipv6 was basically the same as ipv4, but just with more addresses. Nope!

Here are some differences I learned about:

  • There are no broadcast addresses in ipv6.
  • Ipv6 has anycast addresses.
  • There are no subnet masks in ipv6. Instead there are network prefixes.
  • Ipv6 does not use address resolution protocol (ARP). Instead it uses neighbor discovery protocol (NDP).

📩 Using Gerrit

After I added the IP examples, I was ready to submit them. But golang does not use github PRs. Instead they use Gerrit following these steps. Instead of using git commit you use git codereview change. This is (supposed to) add a unique Change-Id to the commit. It wasn’t working for me. It turns out that my other CF-relelated git hooks were interfering with the codereview hook. I removed the other hooks from the repo and everything worked. Then I submitted my change with git codereview mail. You can view my change here.

The go bot sent a welcome message 😊

Congratulations on opening your first change. Thank you for your contribution!

I also learned that the golang project is in code freeze from may-july and nov-jan. I am glad I picked aug-nov for my sabbatical! At least I’ll get 2 months not during a freeze.