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

x/exp/cmd/apidiff: reports bogus changes between identical export data #67051

Open
pohly opened this issue Apr 26, 2024 · 1 comment
Open

x/exp/cmd/apidiff: reports bogus changes between identical export data #67051

pohly opened this issue Apr 26, 2024 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@pohly
Copy link

pohly commented Apr 26, 2024

Go version

go version go1.22.0 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/pohly/.cache/go-build'
GOENV='/home/pohly/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/nvme/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/nvme/gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/nvme/gopath/go-1.22.0'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/nvme/gopath/go-1.22.0/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/nvme/gopath/src/k8s.io/kubernetes/go.mod'
GOWORK='/nvme/gopath/src/k8s.io/kubernetes/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3365691786=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I am running apidiff -w twice, then compare the exported data. Specific steps:

  • Check out https://github.com/kubernetes/kubernetes.
  • git checkout 17854f0e0a153b06f9d0db096e2cd8ab2fa89c11 (or later - needs to include kubernetes/kubernetes@0c7370b).
  • go install golang.org/x/exp/cmd/apidiff@v0.0.0-20240416160154-fe59bbe5cc7f (current latest)
  • apidiff -m -w /tmp/after.out ./staging/src/k8s.io/client-go
  • apidiff -m /tmp/after.out /tmp/after.out (same file!)

What did you see happen?

Ignoring internal package k8s.io/client-go/applyconfigurations/internal
Ignoring internal package k8s.io/client-go/tools/internal/events
Ignoring internal package k8s.io/client-go/applyconfigurations/internal
Ignoring internal package k8s.io/client-go/tools/internal/events
Incompatible changes:
- ./util/workqueue.BucketRateLimiter: changed from TypedBucketRateLimiter[any] to TypedBucketRateLimiter[T comparable]
- ./util/workqueue.DelayingQueueConfig: changed from TypedDelayingQueueConfig[any] to TypedDelayingQueueConfig[T comparable]
- ./util/workqueue.ItemExponentialFailureRateLimiter: changed from TypedItemExponentialFailureRateLimiter[any] to TypedItemExponentialFailureRateLimiter[T comparable]
- ./util/workqueue.ItemFastSlowRateLimiter: changed from TypedItemFastSlowRateLimiter[any] to TypedItemFastSlowRateLimiter[T comparable]
- ./util/workqueue.MaxOfRateLimiter: changed from TypedMaxOfRateLimiter[any] to TypedMaxOfRateLimiter[T comparable]
- ./util/workqueue.QueueConfig: changed from TypedQueueConfig[any] to TypedQueueConfig[T comparable]
- ./util/workqueue.RateLimitingQueueConfig: changed from TypedRateLimitingQueueConfig[any] to TypedRateLimitingQueueConfig[T comparable]
- ./util/workqueue.Type: changed from Typed[any] to Typed[t comparable]
- ./util/workqueue.WithMaxWaitRateLimiter: changed from TypedWithMaxWaitRateLimiter[any] to TypedWithMaxWaitRateLimiter[T comparable]

Note that e.g. type BucketRateLimiter = TypedBucketRateLimiter[any]. There is no TypedBucketRateLimiter[T comparable].

What did you expect to see?

No changes because the exported data is identical.

@gopherbot gopherbot added this to the Unreleased milestone Apr 26, 2024
@pohly
Copy link
Author

pohly commented Apr 26, 2024

Side note: apidiff also treats kubernetes/kubernetes@0c7370b as an incompatible change:

Incompatible changes:
- ./util/workqueue.BucketRateLimiter: changed from BucketRateLimiter to TypedBucketRateLimiter[any]
- ./util/workqueue.DelayingQueueConfig: changed from DelayingQueueConfig to TypedDelayingQueueConfig[any]
- ./util/workqueue.ItemExponentialFailureRateLimiter: changed from ItemExponentialFailureRateLimiter to TypedItemExponentialFailureRateLimiter[any]
- ./util/workqueue.ItemFastSlowRateLimiter: changed from ItemFastSlowRateLimiter to TypedItemFastSlowRateLimiter[any]
- ./util/workqueue.MaxOfRateLimiter: changed from MaxOfRateLimiter to TypedMaxOfRateLimiter[any]
- ./util/workqueue.New: changed from func() *Type to func() *Typed[any]
- ./util/workqueue.NewDelayingQueueWithConfig: changed from func(DelayingQueueConfig) DelayingInterface to func(TypedDelayingQueueConfig[any]) DelayingInterface
- ./util/workqueue.NewMaxOfRateLimiter: changed from func(...RateLimiter) RateLimiter to func(...TypedRateLimiter[any]) RateLimiter
- ./util/workqueue.NewNamed: changed from func(string) *Type to func(string) *Typed[any]
- ./util/workqueue.NewRateLimitingQueueWithConfig: changed from func(RateLimiter, RateLimitingQueueConfig) RateLimitingInterface to func(RateLimiter, TypedRateLimitingQueueConfig[any]) RateLimitingInterface
- ./util/workqueue.NewWithConfig: changed from func(QueueConfig) *Type to func(TypedQueueConfig[any]) *Typed[any]
- ./util/workqueue.QueueConfig: changed from QueueConfig to TypedQueueConfig[any]
- ./util/workqueue.RateLimitingQueueConfig: changed from RateLimitingQueueConfig to TypedRateLimitingQueueConfig[any]
- ./util/workqueue.Type: changed from Type to Typed[any]
- ./util/workqueue.WithMaxWaitRateLimiter: changed from WithMaxWaitRateLimiter to TypedWithMaxWaitRateLimiter[any]

I think at least some of these are false positives. I can file a separate issue if desired.

@joedian joedian added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

3 participants