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

[enhancement] add couple missing zapcore types #18

Merged
merged 3 commits into from
May 21, 2024

Conversation

mikhail5555
Copy link
Contributor

@mikhail5555 mikhail5555 commented May 16, 2024

Add convertion to the following fields:

  • BinaryType
  • ByteStringType
  • DurationType
  • TimeType
  • TimeFullType
  • StringerType

@mikhail5555 mikhail5555 marked this pull request as draft May 16, 2024 14:06
@mikhail5555
Copy link
Contributor Author

Converted to draft since ArrayMarshalerType seems to not work yet

@mikhail5555 mikhail5555 marked this pull request as ready for review May 16, 2024 14:31
Copy link
Contributor

@natebwangsut natebwangsut left a comment

Choose a reason for hiding this comment

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

When we do type conversion, should we make some assertion on the type to prevent the application from panicking?

e.g.

var myVar interface{}
myVar = "hello world"

myString := myVar.(string)
// this will panic when myVar couldn't be converted to string
var myVar interface{}
myVar = "hello world"

myString, ok := myVar.(string)

if (!ok) {
	// not panic
}

@mikhail5555
Copy link
Contributor Author

All of the direct type conventions are the same as the once that zapcore does, so i don't believe they would require assertions.
(All the logic I added was copy pasted from zapcore encoder), I can add references if you prefer.

@natebwangsut
Copy link
Contributor

should be fine if thats the case

Copy link
Contributor

@natebwangsut natebwangsut left a comment

Choose a reason for hiding this comment

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

LGTM

@mikhail5555
Copy link
Contributor Author

I will add a small test tomorrow

@mikhail5555
Copy link
Contributor Author

@natebwangsut its ready from my side, tested the workflow with act, but you never know if it would actually work on github :)

@mikhail5555
Copy link
Contributor Author

@natebwangsut friendly bump

@chameleon82 chameleon82 merged commit 758f26c into agoda-com:main May 21, 2024
3 checks passed
@chameleon82
Copy link
Collaborator

Thanks for contribution @mikhail5555 !

@mikhail5555 mikhail5555 deleted the missing-conv-types branch May 21, 2024 12:49
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.

None yet

3 participants