Skip to content

Commit 87c7ced

Browse files
authored
support Go 1.11, disallow older versions. (micromdm#499)
Updates for Go versions with module support, deprecating the need for GOPATH, and removing dep as a tool for managing dependencies.
1 parent 9c8885e commit 87c7ced

10 files changed

Lines changed: 136 additions & 389 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2
22
jobs:
3-
build-go1.10:
3+
build-go1.11:
44
docker:
5-
- image: golang:1.10
5+
- image: golang:1.11
66
working_directory: /go/src/github.com/micromdm/micromdm
77
steps: &steps
88
- checkout
@@ -14,4 +14,4 @@ workflows:
1414
version: 2
1515
build:
1616
jobs:
17-
- build-go1.10
17+
- build-go1.11

CONTRIBUTING.md

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,23 @@ Here's a few places to get started and find out what's outstanding.
1515

1616
## Building the project
1717

18-
To build MicroMDM from source, you will need [Go 1.10](https://golang.org/dl/) or later installed.
18+
To build MicroMDM from source, you will need [Go 1.11](https://golang.org/dl/) or later installed.
1919

2020
```
21-
# if GOPATH is unset:
22-
# export GOPATH=${HOME}/go
23-
24-
# clone repo into GOPATH:
25-
git clone git@github.com:micromdm/micromdm $GOPATH/src/github.com/micromdm/micromdm
26-
cd $GOPATH/src/github.com/micromdm/micromdm
27-
28-
# download dependencies and build:
21+
git clone git@github.com:micromdm/micromdm && cd micromdm
2922
make deps
3023
make
3124
3225
# run
3326
./build/darwin/micromdm -h
27+
./build/darwin/mdmctl -h
3428
```
3529

3630
## Git workflow
37-
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.
38-
Example:
3931
```
40-
# clone repo into GOPATH:
41-
git clone git@github.com:micromdm/micromdm $GOPATH/src/github.com/micromdm/micromdm
42-
32+
username=groob
4333
# add your remote/upstream
44-
git remote add groob git@github.com:groob/micromdm.git
34+
git remote add $username git@github.com:groob/micromdm.git
4535
4636
# update from origin/master
4737
git pull --rebase
@@ -51,36 +41,18 @@ git checkout -b my_feature
5141
5242
# push changes from my_feature to your fork.
5343
# -u, --set-upstream set upstream for git pull/status
54-
git push -u groob
44+
git push -u $username
5545
```
5646

5747

58-
## If you're new to Go
59-
60-
Go is a bit different from other languages in its requirements for how it expects its programmers to organize Go code files in directories.
61-
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.
62-
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.
48+
## Go Resources
6349

6450
A few helpful resources for getting started with Go:
6551

6652
* [Writing, building, installing, and testing Go code](https://www.youtube.com/watch?v=XCsL89YtqCs)
6753
* [Resources for new Go programmers](http://dave.cheney.net/resources-for-new-go-programmers)
6854
* [How I start](https://howistart.org/posts/go/1)
6955
* [How to write Go code](https://golang.org/doc/code.html)
70-
* [GOPATH on the go wiki](https://github.com/golang/go/wiki/GOPATH)
71-
72-
To build MicroMDM you will need to:
73-
74-
1. Download and install [`Go`](https://golang.org/dl/)
75-
2. Make a workspace directory and set the `GOPATH` as explained above.
76-
3. Install [`dep`](https://github.com/golang/dep) via the command `go get -u github.com/golang/dep/...`
77-
Note that `dep` is a very new project itself. If you're running trouble with the `dep ensure` command, ping @groob in the #micromdm channel on Slack.
78-
4. `mkdir -p $GOPATH/src/github.com/micromdm`
79-
5. `git clone git@github.com:micromdm/micromdm.git` the project into the above folder.
80-
The repo must always be in the folder `$GOPATH/src/github.com/micromdm/micromdm` even if you forked the project. Add a git remote to your fork to track upstream.
81-
6. `dep ensure` The `dep` command will download and install all necessary dependencies for the project to compile.
82-
7. `go build` or `go install`
83-
8. File an issue or a pull request if the instructions are unclear or problems pop-up for you.
8456

8557
## Important libraries and frameworks
8658

Gopkg.lock

Lines changed: 0 additions & 277 deletions
This file was deleted.

0 commit comments

Comments
 (0)