Hello Tyk Team,
I want to contribute a feature for Tyk for which I have to setup a development environment locally. I am new to go language and its environment so need community help in it. So far I had performed following steps.
brew install go
git clone https://github.com/TykTechnologies/tyk.git
I can see that it pull up all
import packages under
~/.go but end up with following error:
go install: no install location for directory /Users/nazar/GoProjects/tyk outside GOPATH
Now when I run command
go run main.go its showing up following errors;
./main.go:171: undefined: APISpec
./main.go:309: undefined: OAuthManager
./main.go:309: undefined: APISpec
./main.go:364: undefined: APISpec
./main.go:373: undefined: APISpec
./main.go:456: undefined: APISpec
./main.go:477: undefined: APISpec
./main.go:507: undefined: APISpec
./main.go:511: undefined: APISpec
I believe its an issue with properly setting up dependencies of project.
Please help me out in getting started with it.
Hi Nazar! Can you run
git branch and share your output?
I am working on master branch in my fork. Before starting work I merged upstream master to my master branch.
@Martin @matiasb Please help me out setting up and running the project so I can keep ball rolling.
When I run
go run *.go I go following error.
go run: cannot run *_test.go files (analytics_url_normaliser_test.go)
You will need to
As the run command will also try and compile tests
That worked for running the project. Next step I tried to run tests
go test oauth_manager_test.go it shows same errors again.
/oauth_manager_test.go:79: undefined: APISpec
./oauth_manager_test.go:80: undefined: createDefinitionFromString
./oauth_manager_test.go:83: undefined: APISpec
./oauth_manager_test.go:85: undefined: loadAPIEndpoints
./oauth_manager_test.go:86: undefined: RedisStorageManager
./oauth_manager_test.go:87: undefined: RedisStorageManager
./oauth_manager_test.go:88: undefined: RedisStorageManager
./oauth_manager_test.go:90: undefined: addOAuthHandlers
./oauth_manager_test.go:92: undefined: TykNewSingleHostReverseProxy
./oauth_manager_test.go:106: undefined: APISpec
I think its because of workspace setup. Can you please share your workspace directory structure and also your $GOPATH
My workspace is as defined by the golang workspace recommendations.
It’s pretty vanilla.
You can’t run the tests individually like that, you need to run
go test --run TestMethodNamePattern
That will run specific tests
Running the file like that means none of the rest of the package gets built so all the deps fail.
@Martin Here is the PR for review OAuth - Multiple Redirect URIs by nazarhussain · Pull Request #285 · TykTechnologies/tyk · GitHub It will allow people to use multiple redirect uris for oath client. Also added two tests to make sure it works as expected.