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

generate unique id using timestamp + random bits #214

Merged
merged 3 commits into from
May 25, 2018

Conversation

SeeratSek
Copy link
Collaborator

- used rs/xid package
- change Players to use id as key
- players with same name can now play concurrently
@@ -61,6 +64,11 @@ func CreatePlayer(n string, p Position, c string, ws *websocket.Conn) *Player {
}
}

func GenUniqueID() string {
id := xid.New()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool new lib

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool indeed. Was this package added using dep? The Gopkg.toml file should have been updated

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

soo I imported the package before calling dep -add and now i'm having trouble doing dep -add after the fact.. (golang/dep#1670). I can just manually update the Gopkg.toml file with the constraint right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Try that and when you update, I'll pull this branch and try running dep ensure to see if it works

teelau
teelau previously approved these changes May 25, 2018
@coveralls
Copy link

Pull Request Test Coverage Report for Build 138

  • 0 of 6 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.0%) to 47.773%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server/models/player.go 0 6 0.0%
Totals Coverage Status
Change from base Build 113: -1.0%
Covered Lines: 118
Relevant Lines: 247

💛 - Coveralls

Copy link
Collaborator

@brian-nguyen brian-nguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

@brian-nguyen brian-nguyen merged commit 0e59751 into master May 25, 2018
@brian-nguyen brian-nguyen deleted the seerat/unique-id branch May 25, 2018 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants