5.3 KiB
Contributing
Welcome! If you're looking to help, this document is a great place to start!
Finding things that need help
Here's a few places to get started and find out what's outstanding.
- Read through the MDM Protocol Reference on the Apple website. Having a deeper understanding of MDM can help with designing features and uncovering bugs.
- Follow the Quickstart guide and make edits if something doesn't look or work right.
- If you run into a problem that you're not sure how to fix, file a bug in the issue tracker
- Browse through the open issues in the issue tracker. We try to tag issues as beginner friendly where appropriate.
- See something that others might benefit from? Considering updating or writing a wiki page.
Building the project
To build MicroMDM from source, you will need Go 1.10 or later installed.
# if GOPATH is unset:
# export GOPATH=${HOME}/go
# clone repo into GOPATH:
git clone git@github.com:micromdm/micromdm $GOPATH/src/github.com/micromdm/micromdm
cd $GOPATH/src/github.com/micromdm/micromdm
# download dependencies and build:
make deps
make
# run
./build/darwin/micromdm -h
Git workflow
Go requires that your repo lives in $GOPATH/src/github.com/micromdm/micromdm even if you're trying to push to your github fork. To work with a forked copy, use a git remote.
Example:
# clone repo into GOPATH:
git clone git@github.com:micromdm/micromdm $GOPATH/src/github.com/micromdm/micromdm
# add your remote/upstream
git remote add groob git@github.com:groob/micromdm.git
# update from origin/master
git pull --rebase
# create a branch
git checkout -b my_feature
# push changes from my_feature to your fork.
# -u, --set-upstream set upstream for git pull/status
git push -u groob
If you're new to Go
Go is a bit different from other languages in its requirements for how it expects its programmers to organize Go code files in directories.
First, Go requires a folder, called a workspace (you can name it anything you'd like) to exist for go source, dependencies, etc. Before Go 1.8 the path to this folder must always be set in the environment variable GOPATH (example: export GOPATH=/Users/groob/code/go). As of Go 1.8 the default GOPATH is set to $HOME/go but you can still set it to whatever you like.
Your GOPATH must have thee subfolders: bin, pkg, and src. Any code you create must live inside the src folder. It's also helpful to add $GOPATH/bin to your environment's PATH as that is where go install will place go binaries that you build. This makes it so that binaries that are insalled can just be invoked by name rather than their full page.
A few helpful resources for getting started with Go:
- Writing, building, installing, and testing Go code
- Resources for new Go programmers
- How I start
- How to write Go code
- GOPATH on the go wiki
To build MicroMDM you will need to:
- Download and install
Go - Make a workspace directory and set the
GOPATHas explained above. - Install
depvia the commandgo get -u github.com/golang/dep/...Note thatdepis a very new project itself. If you're running trouble with thedep ensurecommand, ping @groob in the #micromdm channel on Slack. mkdir -p $GOPATH/src/github.com/micromdmgit clone git@github.com:micromdm/micromdm.gitthe project into the above folder. The repo must always be in the folder$GOPATH/src/github.com/micromdm/micromdmeven if you forked the project. Add a git remote to your fork to track upstream.dep ensureThedepcommand will download and install all necessary dependencies for the project to compile.go buildorgo install- File an issue or a pull request if the instructions are unclear or problems pop-up for you.
Important libraries and frameworks
MicroMDM is built using a few popular Go packages outside the standard libraries. It might be worth checking them out.
- Go Kit is a set of Go libraries used by MicroMDM to provide logging, and abstractions for building HTTP services. Its examples page is a good place to start.
- BoltDB is a key/value database used to provide persistant storage for many components of MicroMDM.
- gorilla/mux is used to provide routing for http handlers.
Other resources
Also see Contributing wiki page which has some additional notes on running, troubleshooting, and developing with MicroMDM.