I've encountered two issues while trying to build golang- opentelemetry-otel with dh-golang 1.66~exp2:
First, it seems that dh-golang is finding the
go.opentelemetry.io/otel package twice, which results in an attempt to
setup a DUMMY module in the go.work file. This produces an error:
> go: workspace module go.opentelemetry.io/otel is replaced at all versions in
> the go.work file. To fix, remove the replacement from the go.work file or
> specify the version at which to replace the module.
A simple check when generating the go.work file to skip creation of
the DUMMY module works, but I'd like to perhaps fix the issue that's
causing the package being built to show up as a leftover dummy
dependency.
Second, golang-github-davecgh-go-spew-dev is a build dependency of
golang-opentelemetry-otel, and consists of a parent directory without
any Go code or go.mod file, but a single child directory that actually
contains the code. I think this is causing some sort of confusion, as I
get another similar error about github.com/davecgh/go-spew/spew:
> # go.opentelemetry.io/otel
> src/github.com/stretchr/testify/assert/assertions.go:20:2: module
> github.com/davecgh/go-spew/spew provides package
> github.com/davecgh/go-spew/spew and is replaced but not required; to add it:
> go get github.com/davecgh/go-spew/spew
> FAIL go.opentelemetry.io/otel [setup failed]
I thought maybe the DUMMY module created for github.com/davecgh/go-
spew is messing things up somehow (since there shouldn't actually be
any module with that import path present), but maybe that's not it.
When I skip creation of that DUMMY module I get the following error
that bubbles up from `go list`:
> dh_auto_configure: warning: Update debian/rules to include missing mappings:
> dh_auto_configure: warning: - github.com/davecgh/go-spew
However, I'm not sure what's actually trying to include
"github.com/davecgh/go-spew" anywhere in the build. Seems like a bug of
some sort with our new build approach.
Here's a small diff against dh-golang with my current changes:
> diff --git a/lib/Debian/Debhelper/Buildsystem/golang.pm
> b/lib/Debian/Debhelper/Buildsystem/golang.pm
> index 991ad77..3b4c165 100644
> --- a/lib/Debian/Debhelper/Buildsystem/golang.pm
> +++ b/lib/Debian/Debhelper/Buildsystem/golang.pm
> @@ -842,6 +842,12 @@ sub _create_go_work_file {
> print $gowork "\n// Adding dummy modules\n\n";
> }
> foreach my $module (sort keys %dependencies) {
> + # Workaround actual module being listed as a dependency
> + next if $module =~ /^$ENV{DH_GOPKG}/;
> +
> + # Don't create a dummy module if the path currently exists
> + next if -e $this->get_buildpath("src/$module");
> +
> verbose_print("Creating minimal go.mod file for dummy $module");
> my $filepath = $this->get_buildpath("src/DUMMY/$module");
> mkdirs($filepath);
Maybe someone else will see a way to address these two issues in dh-
golang; I'll also keep working on it tomorrow.
Mathias
signature.asc
Description: This is a digitally signed message part
