-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
missing import: model not compiling #255
Comments
Would it be possible for you to try with go1.5? swagger uses GO15VENDOREXPERIMENT and I think it might not be able to find strfmt which is why it's not |
I'm having the same issue with the static 0.3.0 binary. The generated files which have this error simply doesn't have an import statement for strfmt. |
I'll publish new binaries tonight but you do need go-swagger in your GOPATH for this to work out. |
Meaning you should go get go-swagger prior to calling swagger generate? How is it that this affects swagger's ability to generate the correct import statement? Other models are generated with the correct imports. |
@bluedragonx go-swagger makes use of goimports to reformat and get the imports for the generated files. Part of that is optimizing the imports and to discover them properly it wants for them to be in the $GOPATH so goimports can discover them. Anyway for strfmt in particular I've aliased them now which will hopefully keep them |
Thanks, I appreciate the explanation! |
# By Ivan Porto Carrero (45) and others # Via Ivan Porto Carrero (23) and EaseWay Hu (1) * 'master' of https://github.com/go-swagger/go-swagger: (49 commits) fix missing httpkit import in models fix linting error on samples fixes go-swagger#330 package for client is client package update bindata.go update vendored depedencies contributes to go-swagger#96 introduce net/context allow streaming bodies (io.ReadCloser for binary string format) use shared api error in clients fixes go-swagger#325 less overlap for enum names optionally scan for models fixes go-swagger#319 detect if map property is base type fixes go-swagger#322 reinstate --skip-* arguments Add tar, gzip support update vendor for goimports fixes go-swagger#255 more, make a full path for goimports fixes go-swagger#215 ensure file names don't end with _test also recognize application/octet-stream in generator update changelog add missing {{ end }} adds a ResponderFunc helper ... Conflicts: cmd/swagger/commands/generate/server.go generator/shared.go
Hello,
I have generated code from a spec.
While compiling i get an error
Example model file content:
go version go1.4.2 linux/amd64
The text was updated successfully, but these errors were encountered: