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

unkown LeftDelim and RightDelim in swag.Spec #1568

Closed
jamshidi799 opened this issue Apr 25, 2023 · 24 comments · May be fixed by chaos-mesh/chaosd#247
Closed

unkown LeftDelim and RightDelim in swag.Spec #1568

jamshidi799 opened this issue Apr 25, 2023 · 24 comments · May be fixed by chaos-mesh/chaosd#247
Labels

Comments

@jamshidi799
Copy link

jamshidi799 commented Apr 25, 2023

Hi. After updating swag to version v1.16.1 (@latest) the swag init command produce a SwaggerInfo variable with compile error.

Steps to reproduce the behavior:

  1. run the command go install github.com/swaggo/swag/cmd/swag@latest
  2. run swag init
  3. go to docs.go
  4. See error in the bottom of the file

Screenshots
Screenshot 1402-02-05 at 17 48 48

swag version
v1.8.12

go version
go1.19.2 darwin/arm64

OS: mac os Ventura

@litao0515
Copy link

litao0515 commented Apr 26, 2023

can reproduce this issue on release 2.0.0-rc2.

@coolbit-in
Copy link

Same issue for me.

@jamshidi799
Copy link
Author

can reproduce this issue on release 2.0.0-rc2.

yes.

Screenshot 1402-02-09 at 13 06 11

but I am wondering why the Spec struct looks different from the GitHub version(the GitHub version has LeftDelim and RightDelim fields)

Screenshot 1402-02-09 at 13 26 02

@ubogdan
Copy link
Contributor

ubogdan commented Apr 29, 2023

Please update your project swag dependency to the latest version (speaking about go.mod)

@jamshidi799
Copy link
Author

I already have this line in go.mod

require ( github.com/swaggo/swag/v2 v2.0.0-rc2 )

@seunghkong
Copy link

seunghkong commented May 2, 2023

reverted mine to v1.8.12 to avoid this problem.
would be nice if rc builds are not included in the latest tag

@ubogdan
Copy link
Contributor

ubogdan commented May 2, 2023

reverted mine to v1.8.12 to avoid this problem.
would be nice if rc builds are not included in the latest tag

Can you be more specific about this?

@seunghkong
Copy link

ok I was half asleep when I wrote that dumb comment
Somehow I thought 2.0.0-rc2 was installed when I installed with github.com/swaggo/swag/cmd/swag@latest, but I was wrong.

I could reproduce the problem if I go install github.com/swaggo/swag/cmd/swag@latest and swag init, but if I reinstall swag with go install github.com/swaggo/swag/cmd/swag@v1.8.12, the problem disappears for some odd reason.

go version go1.20.3 linux/amd64

reverted mine to v1.8.12 to avoid this problem.
would be nice if rc builds are not included in the latest tag

Can you be more specific about this?

@dnsx2k
Copy link

dnsx2k commented May 4, 2023

Hi! I got the same issue. My Dockerfile has RUN go install github.com/swaggo/swag/cmd/swag@latest and build ends up with /src/****/****.go:434:2: unknown field LeftDelim in struct literal of type "github.com/swaggo/swag".Spec

As @seunghkong mentioned if you change version to swag@v1.8.12 it will work.

@Nerzal
Copy link
Contributor

Nerzal commented May 4, 2023

I just checked out the v1.16.1 version and cannot reproduce the issue.

@dnsx2k what swag version is imported in your go.mod ?

A similar issue existed in V2.0.0-rc2 that has been fixed with V2.0.0-rc3.

@Nerzal Nerzal added the bug label May 4, 2023
@Vanderscycle
Copy link

Vanderscycle commented May 10, 2023

Was having the same issue and decided to add the following line the makefile that I use to synchronize the start:

grep -v ".*Delim" ./backend/docs/docs.go > tmpfile && mv tmpfile ./backend/docs/docs.go

Obviously, not a proper fix, but should prevent you from having to manually remove the 2 lines.

@MrGUOFU
Copy link

MrGUOFU commented May 16, 2023

go get -u github.com/swaggo/swag

@Nerzal
Copy link
Contributor

Nerzal commented May 17, 2023

@Vanderscycle what version of the library is imported in your go.mod?

@XSidik
Copy link

XSidik commented May 18, 2023

go get -u github.com/swaggo/swag

it works for me

@Vanderscycle
Copy link

Vanderscycle commented May 18, 2023

go get -u github.com/swaggo/swag

@Nerzal Works for me now

@hungPhi2603
Copy link

go get -u github.com/swaggo/swag

It works for me

@keoy7am
Copy link

keoy7am commented Jun 7, 2023

go get -u github.com/swaggo/swag

it works for me too, i think this issue can be closed now.

@adisusilayasa
Copy link

go get -u github.com/swaggo/swag

It's solved by update swaggo to the latest version, this issue can be closed

@zutim
Copy link

zutim commented Jun 14, 2023

yeah, for use

go get -u github.com/swaggo/swag

change the link
github.com/swaggo/swag v1.8.12 to
github.com/swaggo/swag v1.16.1 // indirect

you can look at you go.mod

at this version , the error is solved

@davafy111
Copy link

go get -u github.com/swaggo/swag

works for me too

@tclxzhengyang-li
Copy link

yeah, for use

go get -u github.com/swaggo/swag

change the link github.com/swaggo/swag v1.8.12 to github.com/swaggo/swag v1.16.1 // indirect

you can look at you go.mod

at this version , the error is solved
it works for me too

@samuelmaxi
Copy link

go get -u github.com/swaggo/swag

funciona para mim

it worked for me too

@sabuhigr
Copy link

Great, it works thanks!

@Ryan-eng-del
Copy link

It works for me too ! thanks

rivy added a commit to rivy-t/my-app that referenced this issue Mar 19, 2024
- `go get -u github.com/swaggo/swag`
- fixes 'unknown field' ('LeftDelim'/'RightDelim') errors during swagger document creation
- related: [swag ~ unknown LeftDelim and RightDelim in swag.Spec](swaggo/swag#1568)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.