8000 Improve go.mod support in generator by mikkeloscar · Pull Request #1661 · go-swagger/go-swagger · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve go.mod support in generator #1661

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

Merged
merged 2 commits into from
Aug 20, 2018

Conversation

mikkeloscar
Copy link
Contributor

This improves the go.mod support added in #1636 by adding support for
targets not at the module level.

Imagine you generate code like this:

$ swagger generate client --name my-api --target ./pkg/api

Then it would assume go.mod is under pkg/api and not detect that go
modules are used. The fix is to walk up the directory to find the first
occurance of go.mod and assume that as the module base URL.

This improves the `go.mod` support added in go-swagger#1636 by adding support for
targets not at the module level.

Imagine you generate code like this:

```bash
$ swagger generate client --name my-api --target ./pkg/api
```

Then it would assume `go.mod` is under `pkg/api` and not detect that go
modules are used. The fix is to walk up the directory to find the first
occurance of `go.mod` and assume that as the module base URL.

Signed-off-by: Mikkel Oscar Lyderik Larsen <m@moscar.net>
@mikkeloscar
Copy link
Contributor Author

I don't understand why the build is failing, I can run the tests fine locally. Any ideas if it's related to my changes?

@fredbi
Copy link
Contributor
fredbi commented Aug 19, 2018

Looks related to some previous changes I made... I have to investigate there: a bug did sneak in undetected

@fredbi
Copy link
Contributor
fredbi commented Aug 19, 2018

I suggest as a temporary workaround to pass your PR to comment the "Parallel()" statement here

I assume my latest attempt to improve this did introduce some smelly behavior.

You could try this and see if your pr passes. I'll try to fix things up later on.

Signed-off-by: Mikkel Oscar Lyderik Larsen <m@moscar.net>
@codecov
Copy link
codecov bot commented Aug 19, 2018

Codecov Report

Merging #1661 into master will decrease coverage by 0.1%.
The diff coverage is 55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1661      +/-   ##
==========================================
- Coverage   80.31%   80.21%   -0.11%     
==========================================
  Files          38       38              
  Lines        7387     7404      +17     
==========================================
+ Hits         5933     5939       +6     
- Misses        992     1002      +10     
- Partials      462      463       +1
Impacted Files Coverage Δ
generator/shared.go 80.86% <55%> (-1.19%) ⬇️

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 dd867fd...499fa92. Read the comment docs.

@mikkeloscar
Copy link
Contributor Author

@fredbi commenting out the parallel config did make the build run successfully.

@casualjim casualjim merged commit 4c3aa23 into go-swagger:master Aug 20, 2018
@mikkeloscar mikkeloscar deleted the improve-go-mod-support branch August 20, 2018 06:08
@fredbi
Copy link
Contributor
fredbi commented Aug 22, 2018

Found the concurrency bug in unit test. Going to fix it and s 9341 pecifically test for this...

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
0