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

Added the resource/httplink package. #34

Merged
merged 3 commits into from Feb 4, 2020
Merged

Added the resource/httplink package. #34

merged 3 commits into from Feb 4, 2020

Conversation

@yuizumi
Copy link
Collaborator

yuizumi commented Feb 3, 2020

In a subsequent PR, we are going to redesign Preload as a simple struct (currently an interface) with a Link embedded:

type Preload struct {
    *httplink.Link
    Resources []*resource.Resource
}
@yuizumi yuizumi force-pushed the yz.link branch from dd7c452 to 3147822 Feb 3, 2020
@yuizumi yuizumi requested a review from tomokinat Feb 3, 2020
quoted = `"(?:[^"\\]|\\.)*"`
// https://tools.ietf.org/html/rfc8288#section-3
linkParam = token + `\s*(?:=\s*(?:` + token + `|` + quoted + `))?`
linkValue = `<([^<>]*)>(?:\s*;\s*` + linkParam + `)*`

This comment has been minimized.

Copy link
@tomokinat

tomokinat Feb 3, 2020

Collaborator

I'm not familiar with regex magics at all, but does it make sense to give each subexp a name (only for readability)? e.g.

linkValue = `<(?P<rawURL>[^<>]*)>(?:\s*;\s*` + linkParam + `)*`
...
reValue = regexp.MustCompile(`^\s*(?P<rawLink>` + linkValue + `)\s*(?:,|$)`)

This comment has been minimized.

Copy link
@yuizumi

yuizumi Feb 4, 2020

Author Collaborator

I don't like adding real constructs to be never used. I added comments to clarify what m[1] and m[2] capture instead.

This comment has been minimized.

Copy link
@tomokinat

tomokinat Feb 4, 2020

Collaborator

Thanks!

@yuizumi yuizumi merged commit b093629 into master Feb 4, 2020
7 checks passed
7 checks passed
check-format
Details
check-format
Details
go-vet
Details
go-vet
Details
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@yuizumi yuizumi deleted the yz.link branch Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.