Skip to content

Commit 91046ab

Browse files
author
Benjy Weinberger
authored
Upgrade example-go to Pants 2.14.0. (#8)
Also add a pants_from_sources script, for convenience. Also upgrade some used actions.
1 parent ad04686 commit 91046ab

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

.github/workflows/pants.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ jobs:
6161
run: |
6262
# We also smoke test that our release process will work by running `package`.
6363
./pants package ::
64-
./pants run cmd/greeter_en:
65-
./pants run cmd/greeter_es:
64+
./pants run cmd/greeter_en
65+
./pants run cmd/greeter_es
6666
- name: Upload Pants log
67-
uses: actions/upload-artifact@v2
67+
uses: actions/upload-artifact@v3
6868
with:
6969
name: pants-log
7070
path: .pants.d/pants.log

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,55 +58,55 @@ Try these out in this repo!
5858

5959
```
6060
./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.
61+
./pants fmt cmd/greeter_en # Format only this package.
62+
./pants lint pkg/:: # Check that all packages under `pkg` are formatted.
6363
```
6464

6565
## Check compilation
6666

6767
```
6868
./pants check :: # Compile all packages.
69-
./pants check cmd/greeter_en: # Compile only this package and its transitive dependencies.
69+
./pants check cmd/greeter_en # Compile only this package and its transitive dependencies.
7070
```
7171

7272
## Run tests
7373

7474
```
7575
./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.
76+
./pants test pkg/uuid # Run all the tests in this package.
77+
./pants test pkg/uuid -- -run TestGenerateUuid # Run just this one test.
7878
```
7979

8080
## Create a binary file
8181

8282
Writes the result to the `dist/` folder.
8383

8484
```
85-
./pants package cmd/greeter_en:
86-
./pants package cmd:: # Create all binaries.
85+
./pants package cmd/greeter_en
86+
./pants package cmd/:: # Create all binaries.
8787
```
8888

8989
## Run a binary
9090

9191
```
92-
./pants run cmd/greeter_en:
93-
./pants run cmd/greeter_es: -- --help
92+
./pants run cmd/greeter_en
93+
./pants run cmd/greeter_es -- --help
9494
```
9595

9696
## Determine dependencies
9797

9898
```
99-
./pants dependencies cmd/greeter_en:
100-
./pants dependencies --transitive cmd/greeter_en:
99+
./pants dependencies cmd/greeter_en
100+
./pants dependencies --transitive cmd/greeter_en
101101
```
102102

103103
## Determine dependees
104104

105105
That is, find what code depends on a particular package(s).
106106

107107
```
108-
./pants dependees pkg/uuid:
109-
./pants dependees --transitive pkg/uuid:
108+
./pants dependees pkg/uuid
109+
./pants dependees --transitive pkg/uuid
110110
```
111111

112112
## Count lines of code

pants.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# Licensed under the Apache License, Version 2.0 (see LICENSE).
33

44
[GLOBAL]
5-
pants_version = "2.9.0.dev3"
5+
pants_version = "2.14.0"
66
backend_packages = ["pants.backend.experimental.go"]
77

88
[anonymous-telemetry]
99
enabled = true
1010
repo_id = "AE018A26-213E-4B18-99A6-6923EC1E16DE"
1111

1212
[golang]
13-
expected_version = "1.17"
13+
minimum_expected_version = "1.17"

pants_from_sources

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2020 Pants project contributors.
3+
# Licensed under the Apache License, Version 2.0 (see LICENSE).
4+
5+
# Runs pants from sources. Useful for debugging.
6+
# Assumes you have the pantsbuild/pants repo checked out in a sibling dir of this dir,
7+
# named 'pants' but overridable using PANTS_SOURCE.
8+
9+
set -euo pipefail
10+
11+
cd "$(git rev-parse --show-toplevel)"
12+
13+
PANTS_SOURCE="${PANTS_SOURCE:-../pants}"
14+
15+
export PANTS_VERSION="$(cat "${PANTS_SOURCE}/src/python/pants/VERSION")"
16+
17+
exec "${PANTS_SOURCE}/pants" "$@"

0 commit comments

Comments
 (0)