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

Zachmu/logger #536

Merged
merged 6 commits into from
Aug 31, 2021
Merged

Zachmu/logger #536

merged 6 commits into from
Aug 31, 2021

Conversation

zachmu
Copy link
Member

@zachmu zachmu commented Aug 31, 2021

No description provided.

Copy link
Contributor

@Hydrocharged Hydrocharged left a comment

Choose a reason for hiding this comment

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

Beautiful

Comment on lines 135 to +137
s.mu.Lock()
sess, ok := s.sessions[conn.ConnectionID]
ir := s.idxRegs[conn.ConnectionID]
vr := s.viewRegs[conn.ConnectionID]
if !ok {
var err error
sess, ir, vr, err = s.builder(ctx, conn, s.addr)
s.mu.Unlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

Not an actionable comment, but just something I wish Go had. In C# they have the lock command where some block of code executes under a mutex, guaranteeing that the mutex is always released once leaving the block's scope. In Go we have to declare a function and use defer to get something equivalent, while adding some pains with return handling and whatnot. Just wishing...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah go locking is lame, I blame Rob Pike

@zachmu zachmu merged commit e2d8eb7 into master Aug 31, 2021
@Hydrocharged Hydrocharged deleted the zachmu/logger branch August 31, 2021 22:28
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.

2 participants