Skip to content

spec.go vs spec_go111.go - swagger generate spec command #2711

Answered by casualjim
Huckletoon asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Huckletoon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants