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/go: 'go list -test golang.org/x/net/context' emits two entries with the same path #27906

Closed
bcmills opened this issue Sep 27, 2018 · 5 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Sep 27, 2018

Found while debugging https://golang.org/cl/137076.

This results in duplicated packages returned from golang.org/x/tools/go/packages as well: we might want to apply a workaround there.

~/src/golang.org/x/net/context$ go version
go version devel +55931b5e16 Mon Sep 24 12:55:24 2018 -0400 linux/amd64

~/src/golang.org/x/net/context$ go list -test .
golang.org/x/net/context
golang.org/x/net/context.test
golang.org/x/net/context
golang.org/x/net/context_test [golang.org/x/net/context.test]
~/src/golang.org/x/net/context$ go list -test -json .
{
	"Dir": "/home/bcmills/src/golang.org/x/net/context",
	"ImportPath": "golang.org/x/net/context",
	"ImportComment": "golang.org/x/net/context",
	"Name": "context",
	"Doc": "Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.",
	"Target": "/home/bcmills/pkg/linux_amd64/golang.org/x/net/context.a",
	"Root": "/home/bcmills",
	"Match": [
		"."
	],
	"Stale": true,
	"StaleReason": "build ID mismatch",
	"GoFiles": [
		"context.go",
		"go17.go",
		"go19.go"
	],
	"IgnoredGoFiles": [
		"context_test.go",
		"pre_go17.go",
		"pre_go19.go"
	],
	"Imports": [
		"context",
		"time"
	],
	"Deps": [
		"context",
		"errors",
		"fmt",
		"internal/bytealg",
		"internal/cpu",
		"internal/poll",
		"internal/race",
		"internal/syscall/unix",
		"internal/testlog",
		"io",
		"math",
		"math/bits",
		"os",
		"reflect",
		"runtime",
		"runtime/internal/atomic",
		"runtime/internal/sys",
		"strconv",
		"sync",
		"sync/atomic",
		"syscall",
		"time",
		"unicode",
		"unicode/utf8",
		"unsafe"
	],
	"XTestGoFiles": [
		"withtimeout_test.go"
	],
	"XTestImports": [
		"fmt",
		"golang.org/x/net/context",
		"time"
	]
}
{
	"Dir": "/home/bcmills/src/golang.org/x/net/context",
	"ImportPath": "golang.org/x/net/context.test",
	"Name": "main",
	"Root": "/home/bcmills",
	"Stale": true,
	"StaleReason": "stale dependency: golang.org/x/net/context",
	"GoFiles": [
		"/home/bcmills/.cache/go-build/e4/e4727a441318fe2b2fb3fd1bf686cae79fca461fc360b776cda7c662b7ead770-d"
	],
	"Imports": [
		"golang.org/x/net/context",
		"golang.org/x/net/context_test [golang.org/x/net/context.test]",
		"os",
		"testing",
		"testing/internal/testdeps"
	],
	"ImportMap": {
		"golang.org/x/net/context_test": "golang.org/x/net/context_test [golang.org/x/net/context.test]"
	},
	"Deps": [
		"bufio",
		"bytes",
		"compress/flate",
		"compress/gzip",
		"context",
		"encoding/binary",
		"errors",
		"flag",
		"fmt",
		"golang.org/x/net/context",
		"golang.org/x/net/context_test [golang.org/x/net/context.test]",
		"hash",
		"hash/crc32",
		"internal/bytealg",
		"internal/cpu",
		"internal/poll",
		"internal/race",
		"internal/syscall/unix",
		"internal/testlog",
		"io",
		"io/ioutil",
		"math",
		"math/bits",
		"os",
		"path/filepath",
		"reflect",
		"regexp",
		"regexp/syntax",
		"runtime",
		"runtime/debug",
		"runtime/internal/atomic",
		"runtime/internal/sys",
		"runtime/pprof",
		"runtime/trace",
		"sort",
		"strconv",
		"strings",
		"sync",
		"sync/atomic",
		"syscall",
		"testing",
		"testing/internal/testdeps",
		"text/tabwriter",
		"time",
		"unicode",
		"unicode/utf8",
		"unsafe"
	]
}
{
	"Dir": "/home/bcmills/src/golang.org/x/net/context",
	"ImportPath": "golang.org/x/net/context",
	"ImportComment": "golang.org/x/net/context",
	"Name": "context",
	"Doc": "Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.",
	"Target": "/home/bcmills/pkg/linux_amd64/golang.org/x/net/context.a",
	"Root": "/home/bcmills",
	"Match": [
		"."
	],
	"Stale": true,
	"StaleReason": "build ID mismatch",
	"GoFiles": [
		"context.go",
		"go17.go",
		"go19.go"
	],
	"IgnoredGoFiles": [
		"context_test.go",
		"pre_go17.go",
		"pre_go19.go"
	],
	"Imports": [
		"context",
		"time"
	],
	"Deps": [
		"context",
		"errors",
		"fmt",
		"internal/bytealg",
		"internal/cpu",
		"internal/poll",
		"internal/race",
		"internal/syscall/unix",
		"internal/testlog",
		"io",
		"math",
		"math/bits",
		"os",
		"reflect",
		"runtime",
		"runtime/internal/atomic",
		"runtime/internal/sys",
		"strconv",
		"sync",
		"sync/atomic",
		"syscall",
		"time",
		"unicode",
		"unicode/utf8",
		"unsafe"
	],
	"XTestGoFiles": [
		"withtimeout_test.go"
	],
	"XTestImports": [
		"fmt",
		"golang.org/x/net/context",
		"time"
	]
}
{
	"Dir": "/home/bcmills/src/golang.org/x/net/context",
	"ImportPath": "golang.org/x/net/context_test [golang.org/x/net/context.test]",
	"Name": "context_test",
	"Root": "/home/bcmills",
	"ForTest": "golang.org/x/net/context",
	"Stale": true,
	"StaleReason": "stale dependency: golang.org/x/net/context",
	"GoFiles": [
		"withtimeout_test.go"
	],
	"Imports": [
		"fmt",
		"golang.org/x/net/context",
		"time"
	],
	"Deps": [
		"context",
		"errors",
		"fmt",
		"golang.org/x/net/context",
		"internal/bytealg",
		"internal/cpu",
		"internal/poll",
		"internal/race",
		"internal/syscall/unix",
		"internal/testlog",
		"io",
		"math",
		"math/bits",
		"os",
		"reflect",
		"runtime",
		"runtime/internal/atomic",
		"runtime/internal/sys",
		"strconv",
		"sync",
		"sync/atomic",
		"syscall",
		"time",
		"unicode",
		"unicode/utf8",
		"unsafe"
	]
}

CC: @alandonovan @matloob @ianthehat

@bcmills bcmills added GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 27, 2018
@bcmills bcmills added this to the Go1.12 milestone Sep 27, 2018
@rsc
Copy link
Contributor

rsc commented Oct 24, 2018

First thing to check would be whether the same *Package is in the list twice (not such a big deal) or there are different identical *Packages (would be a big deal).

@bcmills
Copy link
Contributor Author

bcmills commented Jan 17, 2019

In this case, they are identical.

~/src/golang.org/x/net/context$ go list -test -json . | jq --slurp '.[0]' > 0.json

~/src/golang.org/x/net/context$ go list -test -json . | jq --slurp '.[2]' > 2.json

~/src/golang.org/x/net/context$ diff {0,2}.json

~/src/golang.org/x/net/context$

@bcmills
Copy link
Contributor Author

bcmills commented Sep 17, 2019

@jayconrod, I wonder if your recent split changes have fixed this...?

@jayconrod
Copy link
Contributor

I can reproduce this with go1.12.9 but not go1.13. I'm not sure what fixed this exactly — I don't think the split changes would apply here.

Should we just close this or does it need more investigation?

@bcmills
Copy link
Contributor Author

bcmills commented Sep 18, 2019

Let's just close it. We can always reopen it if we discover specific steps that continue to reproduce it.

@bcmills bcmills closed this as completed Sep 18, 2019
@golang golang locked and limited conversation to collaborators Sep 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants