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

Restore prune docs #1456

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ It's up to you:
**Cons**

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

Expand Down
36 changes: 36 additions & 0 deletions docs/Gopkg.toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,35 @@ system1-data = "value that is used by a system"
system2-data = "value that is used by another system"
```

## `prune`
`prune` defines the global and per-project prune options for dependencies. The options control which files are not kept when writing the `vendor/` tree.

The following is the current available options:
* `unused-packages` prunes files in unused packages.
* `non-go` prunes files that are not used by Go.
* `go-tests` prunes Go test files.

Some files are preversed by default (check the [isPreservedFile](../gps/prune.go#L254) function for the details).

Prune options are off by default and can be turned on by setting them to `true` at the root level.
```toml
[prune]
non-go = true
```

The same prune options can be defined per-project. An addtional `name` field is required and should represent a project and not a package.


```toml
[prune]
non-go = true

[[prune.project]]
name = "github.com/project/name"
go-tests = true
non-go = false
```

## `constraint`
A `constraint` provides rules for how a [direct dependency](FAQ.md#what-is-a-direct-or-transitive-dependency) may be incorporated into the
dependency graph.
Expand Down Expand Up @@ -171,4 +200,11 @@ codename = "foo"

[metadata]
propertyX = "valueX"

[prune]
unused-packages = true

[[prune.project]]
name = "github.com/user/project2"
unused-packages = false
```