@@ -4,28 +4,26 @@ An example repository to demonstrate Pants's experimental Golang support.
44
55See the [ Golang blog post] ( https://blog.pantsbuild.org/golang-support-pants-28/ ) for some unique
66benefits Pants brings to Golang repositories, and see
7- [ pantsbuild.org/docs/go-overview] ( https://www.pantsbuild.org/v2.8/ docs/go-overview ) for more detailed
7+ [ pantsbuild.org/docs/go-overview] ( https://www.pantsbuild.org/docs/go-overview ) for more detailed
88documentation.
99
1010This is only one possible way of laying out your project with Pants. See
1111[ pantsbuild.org/docs/source-roots#examples] ( https://www.pantsbuild.org/docs/source-roots#examples )
1212for some other example layouts.
1313
14- Note: for now, Pants only supports repositories using a single ` go.mod ` . Please comment on
15- [ #13114 ] ( https://github.com/pantsbuild/pants/issues/13114 ) if you need support for greater
16- than one ` go.mod ` so that we can prioritize adding support.
17-
1814# Running Pants
1915
20- You run Pants goals using the ` ./pants ` wrapper script, which will bootstrap the
21- configured version of Pants if necessary.
16+ You run Pants goals using the ` pants ` launcher binary, which will bootstrap the
17+ version of Pants configured for this repo if necessary.
18+
19+ See [ here] ( https://www.pantsbuild.org/docs/installation ) for how to install the ` pants ` binary.
2220
2321# Goals
2422
2523Pants commands are called _ goals_ . You can get a list of goals with
2624
2725```
28- ./ pants help goals
26+ pants help goals
2927```
3028
3129Most goals take arguments to run on. To run on a single directory, use the directory name with
3533For example:
3634
3735```
38- ./ pants lint cmd: internal::
36+ pants lint cmd: internal::
3937```
4038
4139You can run on all changed files:
4240
4341```
44- ./ pants --changed-since=HEAD lint
42+ pants --changed-since=HEAD lint
4543```
4644
4745You can run on all changed files, and any of their "dependees":
4846
4947```
50- ./ pants --changed-since=HEAD --changed-dependees=transitive test
48+ pants --changed-since=HEAD --changed-dependees=transitive test
5149```
5250
5351# Example Goals
@@ -57,60 +55,60 @@ Try these out in this repo!
5755## Run Gofmt
5856
5957```
60- ./ pants fmt :: # Format all packages.
61- ./ pants fmt cmd/greeter_en # Format only this package.
62- ./ pants lint pkg/ :: # Check that all packages under `pkg` are formatted.
58+ pants fmt :: # Format all packages.
59+ pants fmt cmd/greeter_en: # Format only this package.
60+ pants lint pkg:: # Check that all packages under `pkg` are formatted.
6361```
6462
6563## Check compilation
6664
6765```
68- ./ pants check :: # Compile all packages.
69- ./ pants check cmd/greeter_en # Compile only this package and its transitive dependencies.
66+ pants check :: # Compile all packages.
67+ pants check cmd/greeter_en: # Compile only this package and its transitive dependencies.
7068```
7169
7270## Run tests
7371
7472```
75- ./ pants test :: # Run all tests in the repository.
76- ./ pants test pkg/uuid # Run all the tests in this package.
77- ./ pants test pkg/uuid -- -run TestGenerateUuid # Run just this one test.
73+ pants test :: # Run all tests in the repository.
74+ pants test pkg/uuid: # Run all the tests in this package.
75+ pants test pkg/uuid: -- -run TestGenerateUuid # Run just this one test.
7876```
7977
8078## Create a binary file
8179
8280Writes the result to the ` dist/ ` folder.
8381
8482```
85- ./ pants package cmd/greeter_en
86- ./ pants package cmd/ :: # Create all binaries.
83+ pants package cmd/greeter_en:
84+ pants package cmd:: # Create all binaries.
8785```
8886
8987## Run a binary
9088
9189```
92- ./ pants run cmd/greeter_en
93- ./ pants run cmd/greeter_es -- --help
90+ pants run cmd/greeter_en:
91+ pants run cmd/greeter_es: -- --help
9492```
9593
9694## Determine dependencies
9795
9896```
99- ./ pants dependencies cmd/greeter_en
100- ./ pants dependencies --transitive cmd/greeter_en
97+ pants dependencies cmd/greeter_en:
98+ pants dependencies --transitive cmd/greeter_en:
10199```
102100
103101## Determine dependees
104102
105103That is, find what code depends on a particular package(s).
106104
107105```
108- ./ pants dependees pkg/uuid
109- ./ pants dependees --transitive pkg/uuid
106+ pants dependees pkg/uuid:
107+ pants dependees --transitive pkg/uuid:
110108```
111109
112110## Count lines of code
113111
114112```
115- ./ pants count-loc '**/*'
113+ pants count-loc '**/*'
116114```
0 commit comments