这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@foxcpp
Copy link
Collaborator

@foxcpp foxcpp commented Dec 29, 2019

@codecov-io
Copy link

codecov-io commented Dec 29, 2019

Codecov Report

Merging #66 into master will increase coverage by 0.02%.
The diff coverage is 63.63%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #66      +/-   ##
=======================================
+ Coverage   61.98%   62%   +0.02%     
=======================================
  Files          15    15              
  Lines         847   858      +11     
=======================================
+ Hits          525   532       +7     
- Misses        278   280       +2     
- Partials       44    46       +2
Impacted Files Coverage Δ
textproto/header.go 79.33% <63.63%> (-0.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6e6e18...6708900. Read the comment docs.

@emersion
Copy link
Owner

Can we make kv a byte slice?

@foxcpp
Copy link
Collaborator Author

foxcpp commented Dec 29, 2019

Can we make kv a byte slice?

I do not see any reason to use []byte over string, but whatever. Done.

@emersion
Copy link
Owner

I do not see any reason to use []byte over string, but whatever. Done.

I should've explained my rationale se we can discuss:

  • []byte makes it clearer users shouldn't generally use this function because it doesn't handle line wrapping
  • []byte ties this function to the wire format (io.Reader) rather than the parsed data
  • Minor: []byte allows to save one allocation

panic("textproto: Header.AddRaw: missing colon")
}
k := textproto.CanonicalMIMEHeaderKey(string(trim(kv[:colon])))
v := kv[colon:]
Copy link
Owner

Choose a reason for hiding this comment

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

We need to un-fold header lines here

Copy link
Owner

@emersion emersion left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@emersion emersion merged commit 71005f4 into emersion:master Dec 29, 2019
@foxcpp foxcpp deleted the addraw branch December 29, 2019 14:56
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.

3 participants