spec.go vs spec_go111.go - swagger generate spec command #2711
-
Hey all, I have a couple of questions I'm hoping to get some insight on.
Any help, answers, and insight would be greatly appreciated - thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
These files exist since there was a change in go 1.11 that changed the way we had to walk the code at compile time. So those 2 files exist for backwards compatibility. I think by now it's safe to remove support for go versions < 1.11 The mechanism for picking the files to include at compile time are build constraints. The files that are using the new way after go1.11 include the following build constraint: // +build go1.11 These files use the codescan package And the other files that include the following build constraint: // +build !go1.11 These files use the scan package. |
Beta Was this translation helpful? Give feedback.
These files exist since there was a change in go 1.11 that changed the way we had to walk the code at compile time. So those 2 files exist for backwards compatibility. I think by now it's safe to remove support for go versions < 1.11
The mechanism for picking the files to include at compile time are build constraints.
The files that are using the new way after go1.11 include the following build constraint:
// +build go1.11
These files use the codescan package
And the other files that include the following build constraint:
// +build !go1.11
These files use the scan package.