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

Add types and allow empty app ID #41

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

warent
Copy link
Contributor

@warent warent commented Apr 7, 2018

No description provided.

@mikeflynn
Copy link
Owner

This change makes sense and is simple enough, but you've got a couple of missing double quotes in your type JSON tags.

@warent
Copy link
Contributor Author

warent commented Apr 8, 2018

I'm not sure if I should be more scared that Go never raised an error or that none of my tests picked it up

Status struct {
Code string `json:"code"`
} `json:"status"`
Values *[]ResolutionValue `json:"values"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Why make this a pointer to a slice? Under the hood a slice uses a pointer.

Values *[]ResolutionValue `json:"values"`
}

type ResolutionValue struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are prefixing other types with Echo perhaps this should be EchoResolutionValue?

@@ -159,8 +159,9 @@ func verifyJSON(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
return
}

// Check the app id
if !echoReq.VerifyAppID(Applications[r.URL.Path].(EchoApplication).AppID) {
if Applications[r.URL.Path] != nil &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should add this nil check logic to VerifyAppID? It would then be much cleaner:

if !echoReq.VerifyAppID() {
    HTTPError(...)
}

@harrisonhjones
Copy link
Contributor

@warent Some IDEs (I use GoLand) will call out/highlight malformed tags.

@rking788
Copy link
Contributor

The go vet tool will warn about incorrect struct tags

@mikeflynn
Copy link
Owner

What's the status on this PR? This conflicts with the current master but if it's still needed, I can merge.

(Also, please don't hesitate to ping me on Twitter [@thatmikeflynn] as my GitHub notifications are impossible to keep up with and for some reason this repo is always at the bottom of the list.)

@harrisonhjones
Copy link
Contributor

@mikeflynn given what @rking788 mentioned how difficult would it be to add a CI check (with go vet) to PRs?

@mikeflynn
Copy link
Owner

That would be great! Have either of you set that up with GitHub PRs before? Any way you can point me in the right direction?

@rking788
Copy link
Contributor

so I'm not sure if there is a different way that I have never tried before. but the only way I can think of is to setup a travis.ci build for the repo (free for open source projects) and then run go test and go vet in the build script. A sample script can be found in the go-cmp project. Actually now that I am reading the # 86 pull request on that project it sounds like vet is running automatically with go 1.10. so it would just need to be the go test command.

@harrisonhjones
Copy link
Contributor

I can try to setup something on my own fork of this project and then, once I get it working, I'll ping y'all.

@harrisonhjones
Copy link
Contributor

@rking788 @mikeflynn PR for adding Travis CI (with instructions!): #45

@rking788
Copy link
Contributor

rking788 commented Aug 3, 2018

Looks like this can now be rebased and then merged?

@mikeflynn
Copy link
Owner

So this got kind of lost in the shuffle. Still important? If someone can resolve the conflict we can merge.

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

4 participants