From 22ff831cfe0e4a45bdd94f11fb85bbffd054d5e8 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 3 Jul 2019 22:59:38 +1000 Subject: [PATCH] update CONTRIBUTING.md to talk about vendoring --- CONTRIBUTING.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c6885898..d87495aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -♥ We love pull requests from everyone ! +Wanna learn Go? This is the project for you! When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository @@ -19,6 +19,40 @@ welcome your pull requests: 6. Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 7. Issue that pull request! +## Vendoring + +We use a vendor directory to store all dependent files. A vendor directory ensures a single source of truth, so that it's clear in each PR what changes are being made, as well as allowing quick testing-out of ideas across various dependent package, or searching the files in your dependent packages via your editor. + +BUT this currently comes at a cost. I have begrudgingly migrated from dep to go modules, and go modules are still working on their support for vendor directories: +https://github.com/golang/go/issues/27227 +https://github.com/golang/go/issues/30240 + +This means there is a little overhead in working with the code base. If you need to make changes to dependent packages, you have two approaches you can take: + +# 1) + +a) Set `export GOFLAGS=-mod=vendor` in your ~/.bashrc file +b) use `go run main.go` to run lazydocker +c) if you need to bump a dependency e.g. jesseduffield/gocui, use + +``` +GOFLAGS= go get -u github.com/jesseduffield/gocui@master +go mod vendor +``` + +# 2) + +a) don't worry about your ~/.bashrc file +b) use `go run -mod=vendor main.go` to run lazydocker +c) if you need to bump a dependency e.g. jesseduffield/gocui, use + +``` +go get -u github.com/jesseduffield/gocui@master +go mod vendor +``` + +Hopefully this will be much more streamlined in the future :) + ## Code of conduct Please note by participating in this project, you agree to abide by the [code of conduct].