tutorial-go-fiber-rest-api
tutorial-go-fiber-rest-api copied to clipboard
make docker.run fails on github.com/swaggo/swag
This is the error that comes back, also, it doesn't matter the version whether it is your default one or 1.8.0:
=> ERROR [builder 6/6] RUN go build -ldflags="-s -w" -o apiserver . 0.7s ------
> [builder 6/6] RUN go build -ldflags="-s -w" -o apiserver .:
#10 0.672 /go/pkg/mod/github.com/swaggo/[email protected]/field_parser.go:13:2: missing go.sum entry for module providing package github.com/go-openapi/spec (imported by github.com/swaggo/swag); to add:
#10 0.672 go get github.com/swaggo/[email protected]
#10 0.672 /go/pkg/mod/github.com/swaggo/[email protected]/ab0x.go:15:2: missing go.sum entry for module providing package golang.org/x/net/webdav (imported by github.com/swaggo/files); to add:
#10 0.672 go get github.com/swaggo/[email protected]
#10 0.672 /go/pkg/mod/github.com/gofiber/fiber/[email protected]/internal/isatty/isatty_tcgets.go:6:8: missing go.sum entry for module providing package golang.org/x/sys/unix (imported by github.com/gofiber/fiber/v2/internal/isatty); to add:
#10 0.672 go get github.com/gofiber/fiber/v2/internal/[email protected]
#10 0.672 /go/pkg/mod/github.com/go-playground/validator/[email protected]/baked_in.go:21:2: missing go.sum entry for module providing package golang.org/x/text/language (imported by github.com/go-playground/validator/v10); to add:
#10 0.672 go get github.com/go-playground/validator/[email protected]
#10 0.672 /go/pkg/mod/github.com/jackc/[email protected]/auth_scram.go:27:2: missing go.sum entry for module providing package golang.org/x/text/secure/precis (imported by github.com/jackc/pgconn); to add:
#10 0.672 go get github.com/jackc/[email protected]
#10 0.672 /go/pkg/mod/github.com/swaggo/[email protected]/operation.go:18:2: missing go.sum entry for module providing package golang.org/x/tools/go/loader (imported by github.com/swaggo/swag); to add:
#10 0.672 go get github.com/swaggo/[email protected]
------
executor failed running [/bin/sh -c go build -ldflags="-s -w" -o apiserver .]: exit code: 1
make: *** [Makefile:40: docker.fiber.build] Error 1
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template!
@salinaaaaaa thanks for your reply!
Please try go mod tidy
at the root of the directory.
Problem persists, the 2nd line may need to be added somewhere in the code perhaps?
#10 0.472 go: github.com/swaggo/[email protected]: missing go.sum entry; to add it:
#10 0.472 go mod download github.com/swaggo/swag
10 4.509 docs/docs.go:343:20: undefined: "github.com/swaggo/swag".Spec
#10 ERROR: executor failed running [/bin/sh -c go build -ldflags="-s -w" -o apiserver .]: exit code: 2
------
> [builder 6/6] RUN go build -ldflags="-s -w" -o apiserver .:
------
executor failed running [/bin/sh -c go build -ldflags="-s -w" -o apiserver .]: exit code: 2
make: *** [Makefile:40: docker.fiber.build] Error 1
Steps to recreate:
- Clone repo
- Modify env.example to just .env
- go mod tidy
- make docker.run
Could you try to run swag init
before make docker.run
?
It still breaks, could you please pull down a fresh copy of your repo and run it? The error is still the same:
#10 [builder 6/6] RUN go build -ldflags="-s -w" -o apiserver .
#10 sha256:398039545f673655bcf0f6af18c0c01a663ca6c3bfa4123d5e68eef47318f92a
#10 4.981 # github.com/koddr/tutorial-go-fiber-rest-api/docs
#10 4.981 docs/docs.go:343:20: undefined: "github.com/swaggo/swag".Spec
#10 ERROR: executor failed running [/bin/sh -c go build -ldflags="-s -w" -o apiserver .]: exit code: 2
------
> [builder 6/6] RUN go build -ldflags="-s -w" -o apiserver .:
------
executor failed running [/bin/sh -c go build -ldflags="-s -w" -o apiserver .]: exit code: 2
make: *** [Makefile:40: docker.fiber.build] Error 1
@koddr Any luck? ...I have tried retooling and upgrading versions, etc and to no avail, sadly :/
@koddr friendly bump can pay bounty to escalate or screen share
@salinaaaaaa sorry, I have no idea why it's happen on your machine.
Yes, I see a problem on your output:
#10 4.981 docs/docs.go:343:20: undefined: "github.com/swaggo/swag".Spec
But on my side (and other), everything is working fine.
Please attempt to check your configuration: maybe you need to download Go packages manually and run swaggo
generation script before dockerizing or something like this.
👋 Hello. Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
⚡️ This issue has been automatically closed because it has not had recent activity.