tutorial-go-fiber-rest-api icon indicating copy to clipboard operation
tutorial-go-fiber-rest-api copied to clipboard

make docker.run fails on github.com/swaggo/swag

Open daddydrac opened this issue 2 years ago • 9 comments

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

daddydrac avatar Feb 25 '22 20:02 daddydrac

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template!

welcome[bot] avatar Feb 25 '22 20:02 welcome[bot]

@salinaaaaaa thanks for your reply!

Please try go mod tidy at the root of the directory.

koddr avatar Feb 28 '22 06:02 koddr

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:

  1. Clone repo
  2. Modify env.example to just .env
  3. go mod tidy
  4. make docker.run

daddydrac avatar Feb 28 '22 19:02 daddydrac

Could you try to run swag init before make docker.run?

koddr avatar Mar 01 '22 06:03 koddr

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

daddydrac avatar Mar 04 '22 16:03 daddydrac

@koddr Any luck? ...I have tried retooling and upgrading versions, etc and to no avail, sadly :/

daddydrac avatar Mar 07 '22 20:03 daddydrac

@koddr friendly bump can pay bounty to escalate or screen share

daddydrac avatar Mar 14 '22 19:03 daddydrac

@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.

koddr avatar Mar 15 '22 14:03 koddr

👋 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.

stale[bot] avatar Jun 13 '22 02:06 stale[bot]

⚡️ This issue has been automatically closed because it has not had recent activity.

stale[bot] avatar Jun 01 '23 12:06 stale[bot]