Skip to content

Contributing to ssh chat

Steven L edited this page Oct 3, 2017 · 1 revision

If you want to contribute to ssh-chat, it is very easy to do so. It's recommended to check the open issues section first to see what issues are open currently. Bugfixes will be prioritized and typically included in the next release of ssh-chat.

Contribution Guidelines

Contributing to ssh-chat can be done through many different ways; looking for bugs and reporting them in issues, reproducing bugs and contributing to existing issues, editing the wiki for mistakes or adding any information that was previously missing, bug fixes in the source code, new feature implementations for ssh-chat, or improving the test cases.

Issues

Issues are for bug reports or feature requests. We ask that if an issue you wanted to submit was already submitted, you simply vote with the emojis instead of smaller, repetitive comments like "+1" or "I agree". If there is a feature you want to see implemented, use the thumbs up emoji.

Wiki Editing

The Wiki is reserved for explaining things in greater detail when the source code comments or README fails to provide enough information. If you found something confusing like how to set up ssh-chat, you can submit an issue for more information to be provided and someone can create a Wiki page to help you, and in turn, this will help future confusion for others.

If you found the grammar or wording confusing on any wiki page, you can also feel free to edit anything.

Golang and Formatting

ssh-chat is built using Google's Golang (or Go for short). ssh-chat works on many platforms, see the release page for all available downloads.

The source code for ssh-chat currently uses the gofmt style of coding. All code must be formatted with gofmt, otherwise the program will fail to build correctly. For more information on gofmt, see here.

For text editors that support Golang, there are many different editors that you can use with varying Golang support:

Cloning and Building ssh-chat

In order to build ssh-chat, you will need a recent version of the Golang compiler. Anything above version 1.5 should work just fine. If ssh-chat makes use of any recently released features, the requirements will change.

In order to build ssh-chat, Golang has to pull in dependencies from listed sources and pull them into one big workspace, called the $GOPATH. The first thing to do is configure your $GOPATH environment variable, and use the get comment in Golang to fetch the ssh-chat code repository and all of it's dependencies.

$ export GOPATH=$HOME/go  # Add this to your ~/.bashrc or similar
$ go get -u github.com/shazow/ssh-chat
$ cd $GOPATH/src/github.com/shazow/ssh-chat
$ make

For more information on how Go builds projects, check this article: How to Write Go Code.

Forking and Pull Requests

If you are unfamiliar with Go, or maybe you have experience writing C/C++ or Java, you should check out these sites to learn some Golang.

For contributions to ssh-chat source code, ssh-chat uses the GitFlow branching model for contribution. New features and bugfixes are done on separate branches from the master branch, and pull requests will merge those branches into the master branch. When enough features and fixes are applied to the master branch, ssh-chat will be tagged for a new release.

In order to contribute to ssh-chat, you must create a forked repository by clicking "fork" at the top-right part of the page. This will create a repository under your account with all of ssh-chat's source code. From here you can run go get -u github.com/username/ssh-chat and do all of the previously mentioned steps for building, but you can actually skip this part by using the original repository and setting up an additional remote location from it.

$ export GOPATH=$HOME/go # steps from before
$ go get -u github.com/shazow/ssh-chat
$ cd $GOPATH/src/github.com/shazow/ssh-chat
$ git remote add myrepo https://github.com/my-username/ssh-chat # add your fork URL here
$ git checkout -b my-new-cool-feature  # switch to a new branch to start working on code

Now after switching to a new branch, you can start adding new features or bugfixing right away and committing. Once you make some changes, you can stage the changes, commit the changes, and push the changes to your forked repository.

$ git status  # check to see your changes
$ git add -A  # add everything (or add individual files with "git add path/to/file")
$ git commit -m "My cool new feature or bugfix"  # commit with a message
$ git push -u myrepo  # push the changes to your forked repository

Once you upload your changes, you can then submit a Pull Request to the original repository for review. If it passes the code review, and the changes pass the Continuous Integration tests on Travis, your changes will be added to the ssh-chat codebase!

Testing Code Locally

Before uploading changes, you should always test them locally to make sure they are working how you envisioned them. The best way is to start a local ssh-chat server and connect a few clients to it.

$ cd $GOPATH/src/github.com/shazow/ssh-chat # cd to the project
$ make  # build the project
$ ./ssh-chat

# in another terminal do
$ ssh -p 2022 username@localhost

Test your changes here, whether it's client commands, private messages, switching rooms, moderation actions, themes, or something related to public key fingerprints.