diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index cac793719c2..ce066ef6667 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a4b8d84dba4..12316ea3a9a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/Makefile b/Makefile index 2f6fa158ffd..222e1d9131d 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 7b037d31709..46103d96007 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -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 diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 079e03ff167..ee51eda83be 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -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= @@ -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= diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 7855a7b00bd..fed94b38794 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -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"