Skip to content

Commit

Permalink
Add crosslink tool (#6237)
Browse files Browse the repository at this point in the history
* Add crosslink info to contributing.md

* Add crosslink

* Remove install-tools requirement

* Add crosslink to check gha

* Add prune flag to crosslink
  • Loading branch information
bryan-aguilar authored Oct 5, 2022
1 parent 3c12ddf commit e0eea95
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ jobs:
git diff -s --exit-code || (echo 'Generated code is out of date, please run "make genotelcorecol" and commit the changes in this PR.' && exit 1)
- name: Multimod verify
run: make multimod-verify
- name: crosslink
run: |
make crosslink
git diff -s --exit-code || (echo 'Replace statements are out of date, please run "make crosslink" and commit the changes in this PR.' && exit 1)
unittest:
strategy:
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ When submitting a component to the community, consider breaking it down into sep
stability and quality of the component.
* Once a new component has been added to the executable, please add the component
to the [OpenTelemetry.io registry](https://github.com/open-telemetry/opentelemetry.io#adding-a-project-to-the-opentelemetry-registry).
* intra-repository `replace` statements in `go.mod` files can be automatically inserted by running `make crosslink`. For more information
on the `crosslink` tool see the README [here](https://github.com/open-telemetry/opentelemetry-go-build-tools/tree/main/crosslink).

### Refactoring Work

Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ install-tools:
cd $(TOOLS_MOD_DIR) && $(GOCMD) install golang.org/x/tools/cmd/goimports
cd $(TOOLS_MOD_DIR) && $(GOCMD) install github.com/jcchavezs/porto/cmd/porto
cd $(TOOLS_MOD_DIR) && $(GOCMD) install go.opentelemetry.io/build-tools/multimod
cd $(TOOLS_MOD_DIR) && $(GOCMD) install go.opentelemetry.io/build-tools/crosslink

.PHONY: run
run: otelcorecol
Expand Down Expand Up @@ -433,3 +434,10 @@ checklinks:
command -v markdown-link-check >/dev/null 2>&1 || { echo >&2 "markdown-link-check not installed. Run 'npm install -g markdown-link-check'"; exit 1; }
find . -name \*.md -print0 | xargs -0 -n1 \
markdown-link-check -q -c ./.github/workflows/check_links_config.json || true

# error message "failed to sync logger: sync /dev/stderr: inappropriate ioctl for device"
# is a known issue but does not affect function.
.PHONY: crosslink
crosslink:
@echo "Executing crosslink"
crosslink --root=$(shell pwd) --prune
1 change: 1 addition & 0 deletions internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/tcnksm/ghr v0.16.0
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad
go.opentelemetry.io/build-tools/checkdoc v0.0.0-20220919170044-dd98e8af322a
go.opentelemetry.io/build-tools/crosslink v0.0.0-20220928154055-b00fb8eb9066
go.opentelemetry.io/build-tools/multimod v0.0.0-20220919170044-dd98e8af322a
go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220919170044-dd98e8af322a
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
Expand Down
4 changes: 3 additions & 1 deletion internal/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ github.com/ory/go-acc v0.2.8 h1:rOHHAPQjf0u7eHFGWpiXK+gIu/e0GRSJNr9pDukdNC4=
github.com/ory/go-acc v0.2.8/go.mod h1:iCRZUdGb/7nqvSn8xWZkhfVrtXRZ9Wru2E5rabCjFPI=
github.com/ory/viper v1.7.5 h1:+xVdq7SU3e1vNaCsk/ixsfxE4zylk1TJUiJrY647jUE=
github.com/ory/viper v1.7.5/go.mod h1:ypOuyJmEUb3oENywQZRgeAMwqgOyDqwboO1tj3DjTaM=
github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k=
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
Expand Down Expand Up @@ -699,6 +699,8 @@ go.opentelemetry.io/build-tools v0.0.0-20220919170044-dd98e8af322a h1:YIYu44QGPs
go.opentelemetry.io/build-tools v0.0.0-20220919170044-dd98e8af322a/go.mod h1:DrJ+yXmVxJFBLsfINMJ5XS9SF5tszV+Hnz/BgehnN70=
go.opentelemetry.io/build-tools/checkdoc v0.0.0-20220919170044-dd98e8af322a h1:49MUfIEGigtj3zBuHfbXyi3NB28IyomZSD5+9NXtCps=
go.opentelemetry.io/build-tools/checkdoc v0.0.0-20220919170044-dd98e8af322a/go.mod h1:su7j2uCbwFLI+wY9OI75qoCIehufSjd8SMTZgNGF67s=
go.opentelemetry.io/build-tools/crosslink v0.0.0-20220928154055-b00fb8eb9066 h1:pzmyKrD9qwrQjf/dQFrh6VUegAYv8ckeTXa0SSpoTvI=
go.opentelemetry.io/build-tools/crosslink v0.0.0-20220928154055-b00fb8eb9066/go.mod h1:51Nb7OwlUbc+G3ztt2eqHI7RvWB0awRkI4Dj01pphuU=
go.opentelemetry.io/build-tools/multimod v0.0.0-20220919170044-dd98e8af322a h1:Wx5FNOLNxQP99Tjt7/LDVSBdvpHOor+6+SowiQ/e21E=
go.opentelemetry.io/build-tools/multimod v0.0.0-20220919170044-dd98e8af322a/go.mod h1:ri/TD3nVp7cQN0mjT5txWMhKqpD1gUauIfS3adp3bJo=
go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220919170044-dd98e8af322a h1:+03LEAYTjAEinUuC0rLn/pBJG4Gs+ZTfssuBb8IACJs=
Expand Down
1 change: 1 addition & 0 deletions internal/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
_ "github.com/tcnksm/ghr"
_ "github.com/wadey/gocovmerge"
_ "go.opentelemetry.io/build-tools/checkdoc"
_ "go.opentelemetry.io/build-tools/crosslink"
_ "go.opentelemetry.io/build-tools/multimod"
_ "go.opentelemetry.io/build-tools/semconvgen"
_ "golang.org/x/exp/cmd/apidiff"
Expand Down

0 comments on commit e0eea95

Please sign in to comment.