Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 3.02 KB

CONTRIBUTING.md

File metadata and controls

52 lines (41 loc) · 3.02 KB

Contributing Guide

Getting Started

Making Changes

The PR description should be as detailed as possible. This makes reviewing much easier while at the same time serves as additional documentation that can be referenced by future commits/PRs.

This project treats the root folder of the repository as a Go workspace. This approach has several benefits:

  • it keeps import paths short (no github.com/... prefix)
  • it makes forking and merging easier
  • it simplifies debugging (more compact symbol names)

To develop for gopher-os you need to tweak your GOPATH so that the repository folder is listed before any other GOPATH entry. This allows tools like goimports to figure out the correct (short) import path for any gopher-os package that your code imports. A simple way to do this would be by running the following command: export GOPATH=`pwd`:$GOPATH.

Unit tests and code linting

Before submitting a PR make sure:

  • that your code passes all lint checks: make lint
  • you provide the appropriate unit-tests to ensure that the coverage does not drop below the existing value (currently 100%). Otherwise, when you submit the PR, the CI builder (travis-ci) will flag the build as broken.

Reaching 100% coverage is quite hard and requires the code to be designed with testability in mind. This can get quite tricky if the code you are testing relies on code that cannot be executed while running the tests. For example, if the code you are currently working on needs to map some pages to virtual memory then any call to the vmm package from your test code will cause the go test to segfault.

In cases like this, you need to design the code so calls to such packages can be easily mocked while testing. If you are looking for inspiration here are some examples that follow this approach: