Describe the bug
Installation of latest version 1.6.4 fails and throws the following error.
To Reproduce
Install Latest version
https://github.com/swaggo/swag/commit/95cdaaff5a792f3aa1b9009ab12ef8a4702a26c5
â– 1.6.4
╰─$ go get -u github.com/swaggo/swag/cmd/swag 2 ↵
go: finding github.com/swaggo/swag/cmd/swag latest
go: finding github.com/swaggo/swag/cmd latest
go: finding github.com/alecthomas/template latest
go: finding github.com/swaggo/files latest
go: finding golang.org/x/sys latest
go: finding golang.org/x/net latest
go: finding golang.org/x/tools latest
go: finding golang.org/x/sync latest
go: finding golang.org/x/crypto latest
go: finding github.com/PuerkitoBio/urlesc latest
go: finding golang.org/x/xerrors latest
go: finding gopkg.in/check.v1 latest
go: finding github.com/modern-go/concurrent latest
# github.com/cpuguy83/go-md2man/md2man
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:11:16: undefined: blackfriday.EXTENSION_NO_INTRA_EMPHASIS
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:12:16: undefined: blackfriday.EXTENSION_TABLES
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:13:16: undefined: blackfriday.EXTENSION_FENCED_CODE
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:14:16: undefined: blackfriday.EXTENSION_AUTOLINK
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:15:16: undefined: blackfriday.EXTENSION_SPACE_HEADERS
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:16:16: undefined: blackfriday.EXTENSION_FOOTNOTES
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:17:16: undefined: blackfriday.EXTENSION_TITLEBLOCK
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:19:29: too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown(doc, renderer, extensions)
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:19:9: cannot use &roffRenderer literal (type *roffRenderer) as type blackfriday.Renderer in return argument:
*roffRenderer does not implement blackfriday.Renderer (missing RenderFooter method)
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: undefined: blackfriday.LIST_TYPE_ORDERED
../../../go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: too many errors
Expected behavior
Install the previous version works well
╰─$ go get -u github.com/swaggo/swag/cmd/[email protected] 2 ↵
go: finding github.com/swaggo/swag/cmd/swag v1.6.3
go: finding github.com/swaggo/swag/cmd v1.6.3
go: finding github.com/alecthomas/template latest
go: finding github.com/swaggo/files latest
go: finding github.com/modern-go/concurrent latest
go: finding golang.org/x/net latest
go: finding github.com/PuerkitoBio/urlesc latest
go: finding golang.org/x/tools latest
go: finding golang.org/x/sys latest
go: finding golang.org/x/sync latest
go: finding golang.org/x/xerrors latest
go: finding golang.org/x/crypto latest
go: finding gopkg.in/check.v1 latest
go: downloading github.com/urfave/cli v1.22.2
go: extracting github.com/urfave/cli v1.22.2
Your swag version
1.6.4
Your go version
go1.12.5
Maybe you had better to upgrade go-md2man to v2.0.0
Same issue here. go-md2man is already at 2.0.0
Looks like the same issue here as well. Docker builds in our CI that were functional using go get -u github.com/swaggo/swag/cmd/swag to generate documentation that were working Before the update now fail with the same error message.
Same issue for me. Go version 1.13
# github.com/cpuguy83/go-md2man/md2man
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:11:16: undefined: blackfriday.EXTENSION_NO_INTRA_EMPHASIS
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:12:16: undefined: blackfriday.EXTENSION_TABLES
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:13:16: undefined: blackfriday.EXTENSION_FENCED_CODE
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:14:16: undefined: blackfriday.EXTENSION_AUTOLINK
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:15:16: undefined: blackfriday.EXTENSION_SPACE_HEADERS
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:16:16: undefined: blackfriday.EXTENSION_FOOTNOTES
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:17:16: undefined: blackfriday.EXTENSION_TITLEBLOCK
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:19:29: too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown(doc, renderer, extensions)
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:19:9: cannot use &roffRenderer literal (type *roffRenderer) as type blackfriday.Renderer in return argument:
*roffRenderer does not implement blackfriday.Renderer (missing RenderFooter method)
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: undefined: blackfriday.LIST_TYPE_ORDERED
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: too many errors
The command '/bin/sh -c go get -u github.com/swaggo/swag/cmd/swag' returned a non-zero code: 2
Exited with code exit status 2
Until this is fixed, I started doing go get -u github.com/swaggo/swag/cmd/[email protected] instead to lock myself to 1.6.3
@rametta That was my approach as well, and it does prevent issues with "latest" breaking existing code functionality.
The issue seems like the interdependencies of the latest v1.6.4 changed the target for go-md2man:
v1.6.3
Step 7/14 : RUN go get -u github.com/swaggo/swag/cmd/[email protected]
---> Running in c0e047a1d545
go: finding github.com/swaggo/swag/cmd/swag v1.6.3
go: finding github.com v1.6.3
go: finding github.com/swaggo/swag/cmd v1.6.3
go: finding github.com/swaggo v1.6.3
go: finding golang.org/x/net latest
go: finding github.com/urfave/cli v1.22.2
go: finding golang.org/x/tools latest
go: finding github.com/PuerkitoBio/urlesc latest
go: downloading github.com/urfave/cli v1.22.2
go: downloading golang.org/x/tools v0.0.0-20200107184032-11e9d9cc0042
go: extracting github.com/urfave/cli v1.22.2
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
go: extracting github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
go: downloading github.com/russross/blackfriday/v2 v2.0.1
go: extracting github.com/russross/blackfriday/v2 v2.0.1
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: extracting golang.org/x/tools v0.0.0-20200107184032-11e9d9cc0042
go: extracting github.com/shurcooL/sanitized_anchor_name v1.0.0
go: finding github.com/shurcooL/sanitized_anchor_name v1.0.0
go: finding github.com/cpuguy83/go-md2man/v2 v2.0.0
go: finding github.com/russross/blackfriday/v2 v2.0.1
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0
go: extracting github.com/cpuguy83/go-md2man/v2 v2.0.0
v1.6.4
Step 7/14 : RUN go get -u github.com/swaggo/swag/cmd/[email protected]
---> Running in 95954107b5ed
go: finding github.com v1.6.4
go: finding github.com/swaggo/swag/cmd/swag v1.6.4
go: finding github.com/swaggo/swag/cmd v1.6.4
go: finding github.com/swaggo/swag v1.6.4
go: finding github.com/swaggo v1.6.4
go: downloading github.com/swaggo/swag v1.6.4
go: extracting github.com/swaggo/swag v1.6.4
go: finding github.com/PuerkitoBio/urlesc latest
go: finding golang.org/x/tools latest
go: finding golang.org/x/net latest
go: finding github.com/urfave/cli v1.22.2
go: downloading github.com/swaggo/cli v1.20.0
go: downloading golang.org/x/tools v0.0.0-20200107184032-11e9d9cc0042
go: extracting github.com/swaggo/cli v1.20.0
go: extracting golang.org/x/tools v0.0.0-20200107184032-11e9d9cc0042
go: finding github.com/swaggo/cli v1.22.2
go: downloading github.com/swaggo/cli v1.22.2
go: extracting github.com/swaggo/cli v1.22.2
go: downloading github.com/cpuguy83/go-md2man v1.0.10
go: extracting github.com/cpuguy83/go-md2man v1.0.10
go: downloading github.com/russross/blackfriday v1.5.2
go: extracting github.com/russross/blackfriday v1.5.2
go: finding github.com/cpuguy83/go-md2man v1.0.10
go: finding github.com/russross/blackfriday v2.0.0+incompatible
go: downloading github.com/russross/blackfriday v2.0.0+incompatible
go: extracting github.com/russross/blackfriday v2.0.0+incompatible
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: extracting github.com/shurcooL/sanitized_anchor_name v1.0.0
go: finding github.com/shurcooL/sanitized_anchor_name v1.0.0
# github.com/cpuguy83/go-md2man/md2man
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:11:16: undefined: blackfriday.EXTENSION_NO_INTRA_EMPHASIS
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:12:16: undefined: blackfriday.EXTENSION_TABLES
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:13:16: undefined: blackfriday.EXTENSION_FENCED_CODE
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:14:16: undefined: blackfriday.EXTENSION_AUTOLINK
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:15:16: undefined: blackfriday.EXTENSION_SPACE_HEADERS
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:16:16: undefined: blackfriday.EXTENSION_FOOTNOTES
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:17:16: undefined: blackfriday.EXTENSION_TITLEBLOCK
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:19:29: too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown(doc, renderer, extensions)
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:19:9: cannot use &roffRenderer literal (type *roffRenderer) as type blackfriday.Renderer in return argument:
*roffRenderer does not implement blackfriday.Renderer (missing RenderFooter method)
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: undefined: blackfriday.LIST_TYPE_ORDERED
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: too many errors
@ubogdan
How do I duplicate this error?
$ pwd
/home/bogdan
$ go version
go version go1.13.4 linux/amd64
$ env | grep GO
$ go get -u github.com/swaggo/swag/cmd/swag
$ ~/go/bin/swag
NAME:
swag - Automatically generate RESTful API documentation with Swagger 2.0 for Go.
USAGE:
swag [global options] command [command options] [arguments...]
VERSION:
v1.6.4
COMMANDS:
init, i Create docs.go
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
@ubogdan Looks like 1.6.4 regresses and remove the /v2 from go-md2man and blackfriday.
1.6.3:
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
go: extracting github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
go: downloading github.com/russross/blackfriday/v2 v2.0.1
go: extracting github.com/russross/blackfriday/v2 v2.0.1
1.6.4
go: downloading github.com/cpuguy83/go-md2man v1.0.10
go: extracting github.com/cpuguy83/go-md2man v1.0.10
go: downloading github.com/russross/blackfriday v1.5.2
go: extracting github.com/russross/blackfriday v1.5.2
@josephzidell there is no way I can help sine you are giving me unuseful hints. Please run the above commands and paste me the results so I can make clue what it is about.
Thanks.
@ubogdan Sure. It gets run in a docker-compose
Step 5/9 : RUN go get -u github.com/swaggo/swag/cmd/swag
---> Running in 377bc60236b4
go: finding github.com/swaggo/swag v1.6.4
go: downloading github.com/swaggo/swag v1.6.4
go: extracting github.com/swaggo/swag v1.6.4
go: finding github.com/PuerkitoBio/urlesc latest
go: finding golang.org/x/net latest
go: finding golang.org/x/tools latest
go: finding github.com/urfave/cli v1.22.2
go: downloading github.com/swaggo/cli v1.20.0
go: downloading golang.org/x/tools v0.0.0-20200107184032-11e9d9cc0042
go: extracting github.com/swaggo/cli v1.20.0
go: extracting golang.org/x/tools v0.0.0-20200107184032-11e9d9cc0042
go: finding github.com/swaggo/cli v1.22.2
go: downloading github.com/swaggo/cli v1.22.2
go: extracting github.com/swaggo/cli v1.22.2
go: downloading github.com/cpuguy83/go-md2man v1.0.10
go: extracting github.com/cpuguy83/go-md2man v1.0.10
go: finding github.com/cpuguy83/go-md2man v1.0.10
# github.com/cpuguy83/go-md2man/md2man
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:11:16: undefined: blackfriday.EXTENSION_NO_INTRA_EMPHASIS
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:12:16: undefined: blackfriday.EXTENSION_TABLES
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:13:16: undefined: blackfriday.EXTENSION_FENCED_CODE
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:14:16: undefined: blackfriday.EXTENSION_AUTOLINK
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:15:16: undefined: blackfriday.EXTENSION_SPACE_HEADERS
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:16:16: undefined: blackfriday.EXTENSION_FOOTNOTES
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:17:16: undefined: blackfriday.EXTENSION_TITLEBLOCK
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/md2man.go:19:29: too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown(doc, renderer, extensions)
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:19:9: cannot use &roffRenderer literal (type *roffRenderer) as type blackfriday.Renderer in return argument:
*roffRenderer does not implement blackfriday.Renderer (missing RenderFooter method)
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: undefined: blackfriday.LIST_TYPE_ORDERED
/go/pkg/mod/github.com/cpuguy83/[email protected]/md2man/roff.go:102:11: too many errors
Service 'builder' failed to build: The command '/bin/sh -c go get -u github.com/swaggo/swag/cmd/swag' returned a non-zero code: 2
@ubogdan I guess https://github.com/swaggo/cli/blob/v1.22.0/go.mod#L7 is the problem , however I wonder why it downloads "github.com/swaggo/cli v1.22.2" in the case "github.com/swaggo/cli v1.20.0" specified in go.mod
@sdghchj I suspect the CI is cloning github.com/swaggo/ into $GOPATH/src/github.com/swaggo/ which is actually disabling VGO.
This is causing go to download the latest library version.
thanks you guys promptly report this issue, I'm fixing it on #603.
Most helpful comment
thanks you guys promptly report this issue, I'm fixing it on #603.