Skip to content
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

Ambiguous import #414

Closed
josephzidell opened this issue Jun 18, 2019 · 2 comments
Closed

Ambiguous import #414

josephzidell opened this issue Jun 18, 2019 · 2 comments
Labels

Comments

@josephzidell
Copy link
Contributor

Describe the bug
When running go build, it throws an error:

cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules:
        github.com/ugorji/go v1.1.4 (C:\Users\xyz\go\pkg\mod\github.com\ugorji\g[email protected]\codec)
        github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 (C:\Users\xyz\go\pkg\mod\github.com\ugorji\go\c[email protected])

To Reproduce
Steps to reproduce the behavior:

  1. Add the imports and code comments
  2. Run go build

Expected behavior
The build should succeed

Screenshots
If applicable, add screenshots to help explain your problem.

Your swag version
1.5.1

Your go version
1.12.5

Desktop (please complete the following information):

  • OS: WIndows 10
  • Browser: Firefox
  • Version: 67.0.2

Additional context
Full output

c:\code\abc\api>go build
go: finding github.com/stretchr/testify v1.3.0
go: finding github.com/joho/godotenv v1.3.0
go: finding github.com/go-openapi/spec v0.19.2
go: finding github.com/swaggo/swag v1.5.1
go: finding github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: finding github.com/gin-gonic/gin v1.4.0
go: finding golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56
go: finding golang.org/x/sys v0.0.0-20190618155005-516e3c20635f
go: finding golang.org/x/tools v0.0.0-20190618163018-fdf1049a943a
go: finding gopkg.in/goracle.v2 v2.16.0
go: finding golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468
go: finding github.com/go-openapi/spec v0.19.0
go: finding golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f
go: finding github.com/swaggo/gin-swagger v1.1.0
go: finding github.com/stretchr/objx v0.2.0
go: finding github.com/go-openapi/jsonpointer v0.19.2
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/pkg/errors v0.8.1
go: finding github.com/go-openapi/jsonreference v0.19.2
go: finding golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: finding github.com/go-stack/stack v1.8.0
go: finding github.com/modern-go/reflect2 v1.0.1
go: finding github.com/go-kit/kit v0.8.0
go: finding golang.org/x/net v0.0.0-20181005035420-146acd28ed58
go: finding github.com/go-openapi/swag v0.19.2
go: finding github.com/go-openapi/jsonreference v0.17.0
go: finding github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329
go: finding github.com/go-openapi/jsonreference v0.18.0
go: finding github.com/PuerkitoBio/purell v1.1.0
go: finding github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: finding github.com/golang/protobuf v1.3.1
go: finding github.com/go-openapi/jsonpointer v0.17.0
go: finding gopkg.in/go-playground/assert.v1 v1.2.1
go: finding github.com/kr/pretty v0.1.0
go: finding golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: finding github.com/swaggo/swag v1.4.0
go: finding golang.org/x/text v0.3.0
go: finding github.com/ugorji/go v1.1.4
go: finding golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/google/go-cmp v0.2.0
go: finding github.com/go-openapi/swag v0.17.0
go: finding github.com/golang/protobuf v1.2.0
go: finding golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59
go: finding github.com/PuerkitoBio/purell v1.1.1
go: finding github.com/gin-gonic/gin v1.3.0
go: finding github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3
go: finding golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding github.com/pkg/errors v0.8.0
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding gopkg.in/yaml.v2 v2.2.2
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding github.com/mattn/go-isatty v0.0.4
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding github.com/stretchr/objx v0.1.0
go: finding golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e
go: finding github.com/go-openapi/spec v0.18.0
go: finding github.com/kr/pty v1.1.5
go: finding gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: finding golang.org/x/text v0.3.2
go: finding gopkg.in/go-playground/validator.v8 v8.18.2
go: finding golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8
go: finding github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2
go: finding github.com/ghodss/yaml v1.0.0
go: finding github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63
go: finding golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
go: finding github.com/go-openapi/jsonreference v0.19.0
go: finding github.com/stretchr/testify v1.2.2
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: finding github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: finding golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
go: finding github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7
go: finding golang.org/x/tools v0.0.0-20190110015856-aa033095749b
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: finding github.com/kr/text v0.1.0
go: finding github.com/json-iterator/go v1.1.6
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/mattn/go-isatty v0.0.7
go: finding github.com/urfave/cli v1.20.0
go: finding github.com/go-logfmt/logfmt v0.4.0
go: finding golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
go: finding github.com/kr/pty v1.1.1
go: finding github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515
go: downloading gopkg.in/goracle.v2 v2.16.0
go: downloading github.com/joho/godotenv v1.3.0
go: downloading github.com/gin-gonic/gin v1.4.0
go: downloading github.com/swaggo/gin-swagger v1.1.0
go: downloading github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: downloading github.com/swaggo/swag v1.5.1
go: extracting github.com/joho/godotenv v1.3.0
go: extracting github.com/gin-gonic/gin v1.4.0
go: extracting github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: extracting github.com/swaggo/swag v1.5.1
go: downloading github.com/pkg/errors v0.8.1
go: downloading github.com/go-openapi/jsonreference v0.19.2
go: downloading github.com/go-openapi/spec v0.19.2
go: downloading golang.org/x/tools v0.0.0-20190618163018-fdf1049a943a
go: extracting gopkg.in/goracle.v2 v2.16.0
go: downloading github.com/golang/protobuf v1.3.1
go: downloading github.com/mattn/go-isatty v0.0.7
go: downloading github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3
go: extracting github.com/go-openapi/jsonreference v0.19.2
go: extracting github.com/pkg/errors v0.8.1
go: downloading github.com/PuerkitoBio/purell v1.1.1
go: extracting github.com/go-openapi/spec v0.19.2
go: downloading github.com/go-openapi/jsonpointer v0.19.2
go: downloading gopkg.in/go-playground/validator.v8 v8.18.2
go: downloading gopkg.in/yaml.v2 v2.2.2
go: extracting golang.org/x/tools v0.0.0-20190618163018-fdf1049a943a
go: extracting github.com/golang/protobuf v1.3.1
go: extracting github.com/mattn/go-isatty v0.0.7
go: extracting github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3
go: extracting github.com/PuerkitoBio/purell v1.1.1
go: extracting github.com/go-openapi/jsonpointer v0.19.2
go: downloading github.com/ugorji/go v1.1.4
go: downloading github.com/go-openapi/swag v0.19.2
go: downloading golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
go: downloading golang.org/x/text v0.3.2
go: extracting gopkg.in/go-playground/validator.v8 v8.18.2
go: extracting gopkg.in/yaml.v2 v2.2.2
go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting github.com/go-openapi/swag v0.19.2
go: extracting github.com/ugorji/go v1.1.4
go: downloading github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63
go: downloading github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2
go: extracting golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
go: extracting github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63
go: extracting github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2
go: extracting github.com/swaggo/gin-swagger v1.1.0
go: extracting golang.org/x/text v0.3.2
build gitlab.com/abc/api: cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules:
        github.com/ugorji/go v1.1.4 (C:\Users\xyz\go\pkg\mod\github.com\ugorji\g[email protected]\codec)
        github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 (C:\Users\xyz\go\pkg\mod\github.com\ugorji\go\c[email protected])
@josephzidell
Copy link
Contributor Author

Same thing is happening on a linux container in docker:

...
Step 16/18 : RUN go install -v ./...
 ---> Running in f3b1c69ff4ef
build gitlab.com/abc/api: cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules:
        github.com/ugorji/go v1.1.4 (/go/pkg/mod/github.com/ugorji/[email protected]/codec)
        github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 (/go/pkg/mod/github.com/ugorji/go/[email protected])
ERROR: Service 'api' failed to build: The command '/bin/sh -c go install -v ./...' returned a non-zero code: 1

@easonlin404
Copy link
Member

It seems like not swag issue because github.com/ugorji/go/codec has been removed on 783d9d5#diff-37aff102a57d3d7b797f152915a6dc16L24.

please reference gin-gonic/gin#1897, it will help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants