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

Open
bcmills opened this issue Sep 27, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@bcmills
Copy link
Member

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 this to the Go1.12 milestone Sep 27, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member Author

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$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.