supertokens / supertokens-golang

GoLang SDK for SuperTokens
https://supertokens.com
Other
115 stars 34 forks source link

Added typing to avoid overflow warnings #399

Closed DLzer closed 6 months ago

DLzer commented 6 months ago

Summary of change

SuperTokens-golang Version 0.17.4

This PR Adds a type uint64 to the accessTokenCookiesExpiryDurationMillis local variable in recipe/session/utils.go. It also removes the redundant uint64 type forcing needed because of the untyped variable.

Reason:

While using GoReleaser to generate a release of my project using the supertokens-golang SDK it flagged an error building the binary for linux_386 | Linux i386.

The error:

⨯ release failed after 52s  error=failed to build for linux_386: exit status 1: # github.com/supertokens/supertokens-golang/recipe/session
/root/go/pkg/mod/github.com/supertokens/supertokens-golang@v0.17.4/recipe/session/utils.go:242:46: cannot use 3153600000000 (untyped int constant) as int value in variable declaration (overflows)

Related issues

398 GoReleaser Fails on account of an untyped variable declaration

Test Plan

There were no dedicated test cases in the utils_test.go file. However the locally affected variable can be tested to make sure of type and overflow but running it against it's local case: GetCurrTimeInMS() + accessTokenCookiesExpiryDurationMillis. I will provide a screenshot of the output in the GoBetterPlayground and a link below.

Go Better Playground Test

ad301f71f1a905288ca6ac96f1395ffb

Documentation changes

Not-relevant for documentation changes.

Checklist for important updates

Remaining TODOs for this PR

rishabhpoddar commented 6 months ago

Thanks @DLzer ❤️