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

Use go install instead of go get in the README example #434

Closed
migueleliasweb opened this issue Aug 26, 2021 · 9 comments
Closed

Use go install instead of go get in the README example #434

migueleliasweb opened this issue Aug 26, 2021 · 9 comments

Comments

@migueleliasweb
Copy link
Contributor

migueleliasweb commented Aug 26, 2021

Hi oapi-codegen team,

If we use go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.8.2 instead of the current example go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen, Go doesn't add oapi-codegen as an indirect dependency of the repo. This makes the go.mod cleaner overall.

Would it make sense to change this?

@davidovich
Copy link

go install appeared only in go 1.16, so I believe that the minimum supported version of oapi-codegen would have to be bumped.

That being said, I really agree that go install is a better alternative.

@migueleliasweb
Copy link
Contributor Author

I just noticed the go.mod is still mentioning 1.14 =/.

It could be worth at least a mention in the docs something like:

If you're using Go 1.16+ a cleaner installation (without touching your go.mod) can be achieved by running:

go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.8.2

@davidovich
Copy link

davidovich commented Aug 26, 2021

@migueleliasweb The version in the go.mod file is not the culprit, as it states the minimum version of go (feature wise) needed to compile the code (and warn if a compile error occurs that it might be because of the required go version). The maintainer's intended audience go version is what is important here as not all users will have the go install command behave in expected fashion.

As you mention, a conditional advice depending on the go version in the readme seems to be the only way to help users until the last supported version of this project is upgraded to 1.16. I believe @deepmap-marcinr is working on a v2, and is targeting 1.16.

@batazor
Copy link

batazor commented Mar 28, 2022

@migueleliasweb Perhaps it's time to update the manual?

@TarekAS
Copy link

TarekAS commented Apr 15, 2022

Agreed, this has caused me some minor confusion today.

@Appstek-ebpf-linux-webassembly

oapi-codegen -package petstore petstore-expanded.yaml > petstore.gen.go

error loading swagger spec
: open petstore-expanded.yaml: no such file or directory

@nickajacks1
Copy link

Fixed by #588 , this may be closed

@jamietanna
Copy link
Collaborator

Thanks folks, you're correct this was closed already

@Siddhartha90
Copy link

If anyone stumbles upon this via google, the conventional way now to install this is:
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest

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

No branches or pull requests

8 participants