安装swagger时,go get -u github.com/swaggo/swag/cmd/swag,遇到以下问题:

package golang.org/x/text/secure/bidirule: golang.org/x/text is a custom import path for https://go.googlesource.com/text, but /Users/guiruliu/go/src/golang.org/x/text is checked out from https://github.com/golang/text.git
package golang.org/x/text/unicode/bidi: golang.org/x/text is a custom import path for https://go.googlesource.com/text, but /Users/guiruliu/go/src/golang.org/x/text is checked out from https://github.com/golang/text.git
package golang.org/x/text/unicode/norm: golang.org/x/text is a custom import path for https://go.googlesource.com/text, but /Users/guiruliu/go/src/golang.org/x/text is checked out from https://github.com/golang/text.git
package golang.org/x/text/width: golang.org/x/text is a custom import path for https://go.googlesource.com/text, but /Users/guiruliu/go/src/golang.org/x/text is checked out from https://github.com/golang/text.git

golang.org/x下已有文件,尝试替换golang.org/x已然失败,于是,直接编译,步骤如下:

1、到src/github.com目录下:git clone https://github.com/swaggo/swag.git

2、cd swag/

3、go install ./cmd/swag