vardius / gorouter

Go Server/API micro framework, HTTP request router, multiplexer, mux
https://rafallorenz.com/gorouter
MIT License
154 stars 17 forks source link

Refactor tests #8

Closed vardius closed 5 years ago

vardius commented 6 years ago

Tests could use some refactor, there are multiple case scenario that repeats just for different settings etc.

frytyler commented 6 years ago

Hey @vardius I'm interested in working on some golang project and stumbled across this however I feel like a huge noobie right now because I have no idea how to get this up and running.

I can't seem to get the dependencies installed for the project.

Any tips?

I can update the contributing guide as well for 1st time contributors to help for next time.

If I can get setup I'll work to get some of the tests refactored.

vardius commented 6 years ago

Hi @frytyler nice to hear that you'd like to help

this router does not have any external dependencies therefore you do not have to install anything using dep or vgo. Simply fork this repository, make changes and create a pull request.

To run tests simply run:

go test -v -race

in the router root directory.

Remember to clone forked repository under GOPATH

frytyler commented 6 years ago

Thanks for the quick response. When I run that I get:

cannot find package "github.com/julienschmidt/httprouter"

but honestly I'm a JS dev first time really trying out go I could be doing something completely wrong haha


# in my $GOPATH I ran
go get github.com/frytyler/gorouter

cd $GOPATH/src/github.com/frytyler/gorouter

go test -v -race
# github.com/vardius/gorouter
benchmark_test.go:8:2: cannot find package "github.com/julienschmidt/httprouter" in any of:
        /usr/local/go/src/github.com/julienschmidt/httprouter (from $GOROOT)
        /Users/tylerfry/sites/go/src/github.com/julienschmidt/httprouter (from $GOPATH)
FAIL    github.com/vardius/gorouter [setup failed]
vardius commented 6 years ago

Ohhh sorry i completely forgot about that, this is a benchmark i did to compere with other router out there.

You can simple comment out benchmark_test.go file. Or just do go get github.com/julienschmidt/httprouter from CLI console. However I am not sure if this will not cause other problems, as this package might changed. So I think it is better to comment it out.

EDIT: I was not using any dependency management tools, when I was writing this router. The proper way of handling this would be to integrate vgo or dep fix benchmark test if the httprouter API has changed

Some resources: https://golang.org/wiki/vgo https://github.com/golang/dep

frytyler commented 6 years ago

Great dep worked seamlessly so I'll add that in a PR regardless if I make any improvements to the tests.

Thanks for your help and patience with me

vardius commented 5 years ago

Closing due to long inactivity