Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: reference to nonexistent package when importing package starting with "go." #49606

Closed
tie opened this issue Nov 16, 2021 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@tie
Copy link
Contributor

tie commented Nov 16, 2021

What version of Go are you using (go version)?

$ gotip version
go version devel go1.18-6e481c0b36c Tue Nov 16 08:58:05 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

No, this has not been released yet.

What did you do?

I’m importing go.opentelemetry.io/otel/semconv/v1.7.0 package and the CI pipeline for tests with gotip broke somewhere between the November 3rd and 5th.

Note that I can’t reproduce the issue with go.uber.org/zap package, which also starts with go. prefix.

What did you expect to see?

Build succeeds and the program prints exception string.

What did you see instead?

# bug
2021/11/16 11:57:15 main: reference to nonexistent package go.opentelemetry.io/otel/semconv/v1.7.0

I’ve bisected the issue to commit 7f2463c (cc @randall77).

Log
git checkout e0e6e4d
Previous HEAD position was 71fc881cff7 cmd/go: ensure that 'go test' prints the FAIL line for a package on a new line
HEAD is now at e0e6e4d23fe internal/fuzz: improve error for mismatched types
sh bisect.sh 
Building Go cmd/dist using /home/tie/sdk/go1.17.1. (go1.17.1 linux/amd64)
Building Go toolchain1 using /home/tie/sdk/go1.17.1.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/tie/sdk/gotip
Installed commands in /home/tie/sdk/gotip/bin
exception

git bisect start
git bisect good
git checkout 71fc881cff79d0f3b352c20b947f4911892864fa
Previous HEAD position was e0e6e4d23fe internal/fuzz: improve error for mismatched types
HEAD is now at 71fc881cff7 cmd/go: ensure that 'go test' prints the FAIL line for a package on a new line
sh bisect.sh 
Building Go cmd/dist using /home/tie/sdk/go1.17.1. (go1.17.1 linux/amd64)
Building Go toolchain1 using /home/tie/sdk/go1.17.1.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/tie/sdk/gotip
Installed commands in /home/tie/sdk/gotip/bin
# bug
2021/11/16 11:42:58 main: reference to nonexistent package go.opentelemetry.io/otel/semconv/v1.7.0

git bisect bad
Bisecting: 21 revisions left to test after this (roughly 5 steps)
[5fd0c49a4d8cd3bfff3c06e17a0fd9c41bc2f64a] cmd/compile/internal/types2: minor cleanups in predicates.go
git bisect run sh bisect.sh
running sh bisect.sh
Building Go cmd/dist using /home/tie/sdk/go1.17.1. (go1.17.1 linux/amd64)
Building Go toolchain1 using /home/tie/sdk/go1.17.1.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/tie/sdk/gotip
Installed commands in /home/tie/sdk/gotip/bin
# bug
2021/11/16 11:47:33 main: reference to nonexistent package go.opentelemetry.io/otel/semconv/v1.7.0

Bisecting: 10 revisions left to test after this (roughly 4 steps)
[91962dfde1a754a0ccdc514c9a2acfae25fc1f5e] syscall: unify unix Recvmsg epilogues
running sh bisect.sh
Building Go cmd/dist using /home/tie/sdk/go1.17.1. (go1.17.1 linux/amd64)
Building Go toolchain1 using /home/tie/sdk/go1.17.1.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/tie/sdk/gotip
Installed commands in /home/tie/sdk/gotip/bin
# bug
2021/11/16 11:50:02 main: reference to nonexistent package go.opentelemetry.io/otel/semconv/v1.7.0

Bisecting: 5 revisions left to test after this (roughly 3 steps)
[d3f5dd57811ca6c55654e67c58cf594fc2e5091e] syscall: migrate new UDP send/recv API to internal/syscall/unix
running sh bisect.sh
Building Go cmd/dist using /home/tie/sdk/go1.17.1. (go1.17.1 linux/amd64)
Building Go toolchain1 using /home/tie/sdk/go1.17.1.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/tie/sdk/gotip
Installed commands in /home/tie/sdk/gotip/bin
# bug
2021/11/16 11:52:27 main: reference to nonexistent package go.opentelemetry.io/otel/semconv/v1.7.0

Bisecting: 2 revisions left to test after this (roughly 1 step)
[cfd016df1fba2a2a104f4cca705aa4357777986b] runtime: on windows, read nanotime with one instruction or issue barrier
running sh bisect.sh
Building Go cmd/dist using /home/tie/sdk/go1.17.1. (go1.17.1 linux/amd64)
Building Go toolchain1 using /home/tie/sdk/go1.17.1.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/tie/sdk/gotip
Installed commands in /home/tie/sdk/gotip/bin
exception

Bisecting: 0 revisions left to test after this (roughly 1 step)
[7f2463cc363fe8dbcbb89d521d1ede650de86c9b] cmd/compile: fix up shape type package
running sh bisect.sh
Building Go cmd/dist using /home/tie/sdk/go1.17.1. (go1.17.1 linux/amd64)
Building Go toolchain1 using /home/tie/sdk/go1.17.1.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/tie/sdk/gotip
Installed commands in /home/tie/sdk/gotip/bin
# bug
2021/11/16 11:57:15 main: reference to nonexistent package go.opentelemetry.io/otel/semconv/v1.7.0

Bisecting: 0 revisions left to test after this (roughly 0 steps)
[74f99d0933d5c201fc17d90ab612cd1a9c7d425f] database/sql: Fix idle connection reuse
running sh bisect.sh
Building Go cmd/dist using /home/tie/sdk/go1.17.1. (go1.17.1 linux/amd64)
Building Go toolchain1 using /home/tie/sdk/go1.17.1.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/tie/sdk/gotip
Installed commands in /home/tie/sdk/gotip/bin
exception

7f2463cc363fe8dbcbb89d521d1ede650de86c9b is the first bad commit
commit 7f2463cc363fe8dbcbb89d521d1ede650de86c9b
Author: Keith Randall <khr@golang.org>
Date:   Wed Nov 3 11:26:37 2021 -0700

    cmd/compile: fix up shape type package
    
    Use go.shape instead of .shape as the package the compiler uses
    to store shape types.
    
    Prevent path escaping for compiler-internal types, so we don't
    need to see %2e everywhere.
    
    Change-Id: I98e39c3b6472560113bdea7e0ba6eb7b81cb35e0
    Reviewed-on: https://go-review.googlesource.com/c/go/+/361174
    Trust: Keith Randall <khr@golang.org>
    Trust: Dan Scales <danscales@google.com>
    Run-TryBot: Keith Randall <khr@golang.org>
    TryBot-Result: Go Bot <gobot@golang.org>
    Reviewed-by: Dan Scales <danscales@google.com>

 src/cmd/compile/internal/types/pkg.go  | 9 ++++++++-
 src/cmd/compile/internal/types/type.go | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)
bisect run success
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 16, 2021
@seankhliao
Copy link
Member

seems to be an issue when the package name doesn't match the directory name, and the module has a go. prefix

@seankhliao seankhliao changed the title Reference to nonexistent package when importing OpenTelemetry semconv packages on tip cmd/compile: reference to nonexistent package when importing package starting with "go." Nov 16, 2021
@seankhliao seankhliao added this to the Go1.18 milestone Nov 16, 2021
@danscales
Copy link
Contributor

Should we switch back to trying to reserve "shape" as a standard lib package name (your proposal #49268) - no dots in "shape", so can't possibly be a user-package path, right (unlike go.shape)?

@randall77

@randall77
Copy link
Contributor

Hmm, I'm not sure this particularly has to do with using go.shape as the package name. We similarly have go.type, go.cuinfo, etc. (Although that prefix pattern in general may be a problem, it isn't newly introduced by the offending CL.)
I think it probably has to do with the other half of that CL, which has to do with escaping the package path. I'll investigate some more.

@tie
Copy link
Contributor Author

tie commented Nov 18, 2021

Looking at the objabi.PathToPrefix implementation, I believe this issue affects all packages with go. prefix where the last path element contains dots.

@Rajalakshmi-Girish
Copy link

We are facing the below failure while trying to build https://github.com/etcd-io/etcd repo with latest upstream golang:

...
....
go: downloading go.opentelemetry.io/proto/otlp v0.9.0
go: downloading github.com/cenkalti/backoff/v4 v4.1.1
go: downloading golang.org/x/text v0.3.6
�[0;94m% 'env' 'GO111MODULE=off' 'go' 'get' 'github.com/myitcv/gobin'
�[0m�[0;94m% 'rm' '-f' 'bin/etcd'
�[0m�[0;94m% (cd server && 'env' 'CGO_ENABLED=0' 'GO_BUILD_FLAGS=' 'GOOS=' 'GOARCH=' 'go' 'build' '-installsuffix=cgo' '-ldflags=-X=go.etcd.io/etcd/api/v3/version.GitSHA=7e0248b36' '-o=../bin/etcd' '.')
�[0m�[0mstderr: �[95mgo: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da�[0m
�[0mstderr: �[95m# go.etcd.io/etcd/server/v3�[0m
�[0mstderr: �[95m2021/11/19 00:49:07 go.etcd.io/etcd/server/v3/embed: reference to nonexistent package go.opentelemetry.io/otel/semconv/v1.4.0�[0m
�[1m�[0;31mFAIL: (code:2):
  % (cd server && 'env' 'CGO_ENABLED=0' 'GO_BUILD_FLAGS=' 'GOOS=' 'GOARCH=' 'go' 'build' '-installsuffix=cgo' '-ldflags=-X=go.etcd.io/etcd/api/v3/version.GitSHA=7e0248b36' '-o=../bin/etcd' '.')
�[0m�[1m�[0;31mFAIL: etcd_build (GOARCH=)
�[0m

Sample failed Run: https://prow.ppc64le-cloud.org/view/s3/prow-logs/logs/postsubmit-master-golang-etcd-build-test-ppc64le/1461496375937077248

@randall77 randall77 self-assigned this Nov 19, 2021
@gopherbot
Copy link

Change https://golang.org/cl/365834 mentions this issue: cmd/compile: special packages must not have any path separators

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

6 participants