Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 74a1bc5

Browse files
authored
Merge pull request #1456 from ibrasho-forks/revert-prune-docs-revert
Restore prune docs
2 parents 7744710 + c584a10 commit 74a1bc5

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

docs/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ It's up to you:
347347
**Cons**
348348

349349
- Your repo will be bigger, potentially a lot bigger,
350-
though `dep prune` can help minimize this problem.
350+
though [`prune`](Gopkg.toml.md#prune) can help minimize this problem.
351351
- PR diffs will include changes for files under `vendor/` when Gopkg.lock is modified,
352352
however files in `vendor/` are [hidden by default](https://github.com/github/linguist/blob/v5.2.0/lib/linguist/generated.rb#L328) on Github.
353353

docs/Gopkg.toml.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,35 @@ system1-data = "value that is used by a system"
5858
system2-data = "value that is used by another system"
5959
```
6060

61+
## `prune`
62+
`prune` defines the global and per-project prune options for dependencies. The options control which files are not kept when writing the `vendor/` tree.
63+
64+
The following is the current available options:
65+
* `unused-packages` prunes files in unused packages.
66+
* `non-go` prunes files that are not used by Go.
67+
* `go-tests` prunes Go test files.
68+
69+
Some files are preversed by default (check the [isPreservedFile](../gps/prune.go#L254) function for the details).
70+
71+
Prune options are off by default and can be turned on by setting them to `true` at the root level.
72+
```toml
73+
[prune]
74+
non-go = true
75+
```
76+
77+
The same prune options can be defined per-project. An addtional `name` field is required and should represent a project and not a package.
78+
79+
80+
```toml
81+
[prune]
82+
non-go = true
83+
84+
[[prune.project]]
85+
name = "github.com/project/name"
86+
go-tests = true
87+
non-go = false
88+
```
89+
6190
## `constraint`
6291
A `constraint` provides rules for how a [direct dependency](FAQ.md#what-is-a-direct-or-transitive-dependency) may be incorporated into the
6392
dependency graph.
@@ -171,4 +200,11 @@ codename = "foo"
171200

172201
[metadata]
173202
propertyX = "valueX"
203+
204+
[prune]
205+
unused-packages = true
206+
207+
[[prune.project]]
208+
name = "github.com/user/project2"
209+
unused-packages = false
174210
```

0 commit comments

Comments
 (0)