Skip to content

Latest commit

 

History

History
88 lines (55 loc) · 2.47 KB

DEVELOPMENT.md

File metadata and controls

88 lines (55 loc) · 2.47 KB

Developing

Setting up a development environment

Setup a GitHub account accessible via SSH

GitHub is used for project Source Code Management (SCM) using the SSH protocol for authentication.

  1. Create a GitHub account if you do not already have one.
  2. Setup GitHub access via SSH

Install tools

You must install these tools:

  1. git: For source control

  2. go: The language this SDK is built in.

    Note Golang version v1.18 or higher is required.

  3. make: not stricly required but handy to run tests with a single command.

Setup a fork

The sdk-go project requires that you develop (commit) code changes to branches that belong to a fork of the cdevents/sdk-go repository in your GitHub account before submitting them as Pull Requests (PRs) to the actual project repository.

  1. Create a fork of the cdevents/sdk-go repository in your GitHub account.

  2. Create a clone of your fork on your local machine:

    git clone git@github.com:${YOUR_GITHUB_USERNAME}/sdk-go.git
  3. Configure git remote repositories

    Adding cdevents/sdk-go as the upstream and your fork as the origin remote repositories to your .git/config sets you up nicely for regularly syncing your fork and submitting pull requests.

    1. Change into the project directory

      cd sdk-go
    2. Configure sdk-go as the upstream repository

      git remote add upstream git@github.com:cdevents/sdk-go.git
      
      # Optional: Prevent accidental pushing of commits by changing the upstream URL to `no_push`
      git remote set-url --push upstream no_push
    3. Configure your fork as the origin repository

      git remote add origin git@github.com:${YOUR_GITHUB_USERNAME}/sdk-go.git

Developing, building and testing

Make target all defined to run unit tests, format imports, format go code and run the linter.

To format the go code and imports:

$ make fmt

To run the go linter:

$ make lint

To run unit tests:

$ make test

To run all targets, before creating a commit:

make all