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

ListAccessUsers returns wrong results for AccessSeat and GatewaySeat when it paginates due to loop variable #1481

Closed
2 tasks done
auyer opened this issue Jan 17, 2024 · 1 comment · Fixed by #1482
Closed
2 tasks done
Milestone

Comments

@auyer
Copy link
Contributor

auyer commented Jan 17, 2024

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the library and it is still present.

cloudflare-go version

v0.86.0

Go environment

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/auyer/.cache/go-build'
GOENV='/home/auyer/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/auyer/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/auyer/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/auyer/code/cloudflare-go/go.mod'
GOWORK=''
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-build3957979889=/tmp/go-build -gno-record-gcc-switches'

Expected output

{
    "id": "...",
    "access_seat": true,
    "active_device_count": 0,
    "created_at": "2024-01-15T13:26:34.003612Z",
    "email": "...",
    "gateway_seat": true,
    "last_successful_login": "2024-01-17T13:48:31Z",
    "name": "...",
    "seat_uid": "...",
    "uid": "...",
    "updated_at": "2024-01-17T13:48:33.499622Z"
}

Actual output

{
    "id": "...",
    "access_seat": false,
    "active_device_count": 0,
    "created_at": "2024-01-15T13:26:34.003612Z",
    "email": "...",
    "gateway_seat": false,
    "last_successful_login": "2024-01-17T13:48:31Z",
    "name": "...",
    "seat_uid": "...",
    "uid": "...",
    "updated_at": "2024-01-17T13:48:33.499622Z"
}

Code demonstrating the issue

res, info, err := api.ListAccessUsers(ctx, account, cloudflare.AccessUserParams{})
u, _ := json.Marshal(res)
fmt.Println(string(res))

Steps to reproduce

  1. Have a list of users that the API will need to auto-paginate
  2. Check the Seats for users that came in pages other then the first

References

This seams to be the same issue as #1447

I believe this issues relates to https://go.dev/blog/loopvar-preview

Copy link
Contributor

This functionality has been released in v0.87.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant