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

protoc-gen-swagger/genswagger does not build on go1.11 and earlier versions #1061

Closed
marcusljx opened this issue Oct 13, 2019 · 1 comment · Fixed by #1062
Closed

protoc-gen-swagger/genswagger does not build on go1.11 and earlier versions #1061

marcusljx opened this issue Oct 13, 2019 · 1 comment · Fixed by #1062

Comments

@marcusljx
Copy link
Contributor

marcusljx commented Oct 13, 2019

Steps you follow to reproduce the error:

<!-- Example steps
1.  I grab my catapult
2.  I load it with lettuce
3.  Press the fire button
4.  It falls over
-->
  1. Using go1.11
  2. import github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger
  3. use genswagger.New() in a main function
  4. go build .
  5. package fails to build because strings package does not have function ReplaceAll.

What did you expect to happen instead:

<!-- Example answer
1.  It would have rained lettuce from the sky bringing forth a cuddly army of bunnies we could
    play with
-->

go build should exit with exit code 0.

What's your theory on why it isn't working:

<!-- Example answer
Evil wizards are hoarding the bunnies and don't want to share. The wizards are casting 
lettuce protection spells so the catapult won't work.
-->

This line uses strings.ReplaceAll, which was only introduced in go1.12.

return strings.ReplaceAll(strings.Title(k), "-", "_")

@marcusljx
Copy link
Contributor Author

I would like to submit a small PR for this to allow for builds on earlier go versions too.

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 a pull request may close this issue.

1 participant