routers/api/v1/api.go:5: running "swagger": exec: "swagger": executable file not found in $PATH #686

Closed
opened 2025-11-02 03:33:10 -06:00 by GiteaMirror · 14 comments
Owner

Originally created by @lunny on GitHub (May 4, 2017).

When I run TAGS=bindata make generate build, it reports the error. @sapk

Originally created by @lunny on GitHub (May 4, 2017). When I run `TAGS=bindata make generate build`, it reports the error. @sapk
GiteaMirror added the type/bugtopic/build labels 2025-11-02 03:33:10 -06:00
Author
Owner

@lunny commented on GitHub (May 4, 2017):

When I run make swagger-ui, it reports:

➜  gitea git:(lunny/autocert) ✗ make swagger-ui
rm -Rf public/assets/swagger-ui
git clone --depth=10 -b v3.0.7 --single-branch https://github.com/swagger-api/swagger-ui.git /tmp/swagger-ui
Cloning into '/tmp/swagger-ui'...
remote: Counting objects: 321, done.
remote: Compressing objects: 100% (237/237), done.
remote: Total 321 (delta 93), reused 207 (delta 69), pack-reused 0
Receiving objects: 100% (321/321), 755.53 KiB | 231.00 KiB/s, done.
Resolving deltas: 100% (93/93), done.
Note: checking out 'b289d5992a00748213d0344c0eacf42a3b7f60c2'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

mv /tmp/swagger-ui/dist public/assets/swagger-ui
rm -Rf /tmp/swagger-ui
sed -i "s;http://petstore.swagger.io/v2/swagger.json;../../swagger.v1.json;g" public/assets/swagger-ui/index.html
sed: 1: "public/assets/swagger-u ...": extra characters at the end of p command
make: *** [swagger-ui] Error 1
@lunny commented on GitHub (May 4, 2017): When I run `make swagger-ui`, it reports: ``` ➜ gitea git:(lunny/autocert) ✗ make swagger-ui rm -Rf public/assets/swagger-ui git clone --depth=10 -b v3.0.7 --single-branch https://github.com/swagger-api/swagger-ui.git /tmp/swagger-ui Cloning into '/tmp/swagger-ui'... remote: Counting objects: 321, done. remote: Compressing objects: 100% (237/237), done. remote: Total 321 (delta 93), reused 207 (delta 69), pack-reused 0 Receiving objects: 100% (321/321), 755.53 KiB | 231.00 KiB/s, done. Resolving deltas: 100% (93/93), done. Note: checking out 'b289d5992a00748213d0344c0eacf42a3b7f60c2'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> mv /tmp/swagger-ui/dist public/assets/swagger-ui rm -Rf /tmp/swagger-ui sed -i "s;http://petstore.swagger.io/v2/swagger.json;../../swagger.v1.json;g" public/assets/swagger-ui/index.html sed: 1: "public/assets/swagger-u ...": extra characters at the end of p command make: *** [swagger-ui] Error 1 ```
Author
Owner

@sapk commented on GitHub (May 4, 2017):

It's two separate problems :

  • make generate execute go generate and api.go now have a generate command based on swagger.
    But make (https://github.com/go-gitea/gitea/blob/master/Makefile#L57) should get swagger before executing go generate. I will have a look into it.
  • make swagger-ui is for updating the swagger-ui interface to display swagger.json (generated by go generate). It seems that the sed command failed.
@sapk commented on GitHub (May 4, 2017): It's two separate problems : - make generate execute go generate and api.go now have a generate command based on swagger. But make (https://github.com/go-gitea/gitea/blob/master/Makefile#L57) should get swagger before executing go generate. I will have a look into it. - make swagger-ui is for updating the swagger-ui interface to display swagger.json (generated by go generate). It seems that the sed command failed.
Author
Owner

@sapk commented on GitHub (May 4, 2017):

In order to reproduce what is your env mostly for sed?
For fixing swagger dep you could add $GOPATH/bin like in drone env or add swagger to your PATH after getting it.

@sapk commented on GitHub (May 4, 2017): In order to reproduce what is your env mostly for sed? For fixing swagger dep you could add $GOPATH/bin like in drone env or add swagger to your PATH after getting it.
Author
Owner

@sapk commented on GitHub (May 9, 2017):

@lunny any news ?

@sapk commented on GitHub (May 9, 2017): @lunny any news ?
Author
Owner

@lunny commented on GitHub (May 9, 2017):

In fact, I think I didn't install swagger correctly?

@lunny commented on GitHub (May 9, 2017): In fact, I think I didn't install swagger correctly?
Author
Owner

@sapk commented on GitHub (May 9, 2017):

For make generate yes and for sed (make swagger-ui that update the dep) I think that it could come from a different version depending of OS maybe I could improve interoperability.

@sapk commented on GitHub (May 9, 2017): For make generate yes and for sed (make swagger-ui that update the dep) I think that it could come from a different version depending of OS maybe I could improve interoperability.
Author
Owner

@sondr3 commented on GitHub (May 14, 2017):

I've run into a sed problem as well, when running env TAGS=sqlite make generate build (I'm using Fish shell) it gives this output:

me@Jupiter ~/C/g/s/c/gitea> env TAGS=sqlite make generate build
go generate code.gitea.io/gitea code.gitea.io/gitea/cmd code.gitea.io/gitea/models code.gitea.io/gitea/models/migrations code.gitea.io/gitea/modules/auth code.gitea.io/gitea/modules/auth/ldap code.gitea.io/gitea/modules/auth/oauth2 code.gitea.io/gitea/modules/auth/openid code.gitea.io/gitea/modules/auth/pam code.gitea.io/gitea/modules/avatar code.gitea.io/gitea/modules/base code.gitea.io/gitea/modules/context code.gitea.io/gitea/modules/cron code.gitea.io/gitea/modules/highlight code.gitea.io/gitea/modules/httplib code.gitea.io/gitea/modules/indexer code.gitea.io/gitea/modules/lfs code.gitea.io/gitea/modules/log code.gitea.io/gitea/modules/mailer code.gitea.io/gitea/modules/markdown code.gitea.io/gitea/modules/markup code.gitea.io/gitea/modules/minwinsvc code.gitea.io/gitea/modules/notification code.gitea.io/gitea/modules/options code.gitea.io/gitea/modules/private code.gitea.io/gitea/modules/process code.gitea.io/gitea/modules/public code.gitea.io/gitea/modules/setting code.gitea.io/gitea/modules/ssh code.gitea.io/gitea/modules/sync code.gitea.io/gitea/modules/templates code.gitea.io/gitea/modules/user code.gitea.io/gitea/modules/util code.gitea.io/gitea/modules/validation code.gitea.io/gitea/routers code.gitea.io/gitea/routers/admin code.gitea.io/gitea/routers/api/v1 code.gitea.io/gitea/routers/api/v1/admin code.gitea.io/gitea/routers/api/v1/convert code.gitea.io/gitea/routers/api/v1/misc code.gitea.io/gitea/routers/api/v1/org code.gitea.io/gitea/routers/api/v1/repo code.gitea.io/gitea/routers/api/v1/user code.gitea.io/gitea/routers/api/v1/utils code.gitea.io/gitea/routers/dev code.gitea.io/gitea/routers/org code.gitea.io/gitea/routers/private code.gitea.io/gitea/routers/repo code.gitea.io/gitea/routers/routes code.gitea.io/gitea/routers/user
bindata.go
bindata.go
bindata.go
sed: 1: "../../../public/swagger ...": invalid command code .
routers/api/v1/api.go:6: running "sed": exit status 1
make: *** [generate] Error 1

I'm on the latest version of OS X, and I'm not sure what to do from here.

@sondr3 commented on GitHub (May 14, 2017): I've run into a sed problem as well, when running `env TAGS=sqlite make generate build` (I'm using Fish shell) it gives this output: ```sh me@Jupiter ~/C/g/s/c/gitea> env TAGS=sqlite make generate build go generate code.gitea.io/gitea code.gitea.io/gitea/cmd code.gitea.io/gitea/models code.gitea.io/gitea/models/migrations code.gitea.io/gitea/modules/auth code.gitea.io/gitea/modules/auth/ldap code.gitea.io/gitea/modules/auth/oauth2 code.gitea.io/gitea/modules/auth/openid code.gitea.io/gitea/modules/auth/pam code.gitea.io/gitea/modules/avatar code.gitea.io/gitea/modules/base code.gitea.io/gitea/modules/context code.gitea.io/gitea/modules/cron code.gitea.io/gitea/modules/highlight code.gitea.io/gitea/modules/httplib code.gitea.io/gitea/modules/indexer code.gitea.io/gitea/modules/lfs code.gitea.io/gitea/modules/log code.gitea.io/gitea/modules/mailer code.gitea.io/gitea/modules/markdown code.gitea.io/gitea/modules/markup code.gitea.io/gitea/modules/minwinsvc code.gitea.io/gitea/modules/notification code.gitea.io/gitea/modules/options code.gitea.io/gitea/modules/private code.gitea.io/gitea/modules/process code.gitea.io/gitea/modules/public code.gitea.io/gitea/modules/setting code.gitea.io/gitea/modules/ssh code.gitea.io/gitea/modules/sync code.gitea.io/gitea/modules/templates code.gitea.io/gitea/modules/user code.gitea.io/gitea/modules/util code.gitea.io/gitea/modules/validation code.gitea.io/gitea/routers code.gitea.io/gitea/routers/admin code.gitea.io/gitea/routers/api/v1 code.gitea.io/gitea/routers/api/v1/admin code.gitea.io/gitea/routers/api/v1/convert code.gitea.io/gitea/routers/api/v1/misc code.gitea.io/gitea/routers/api/v1/org code.gitea.io/gitea/routers/api/v1/repo code.gitea.io/gitea/routers/api/v1/user code.gitea.io/gitea/routers/api/v1/utils code.gitea.io/gitea/routers/dev code.gitea.io/gitea/routers/org code.gitea.io/gitea/routers/private code.gitea.io/gitea/routers/repo code.gitea.io/gitea/routers/routes code.gitea.io/gitea/routers/user bindata.go bindata.go bindata.go sed: 1: "../../../public/swagger ...": invalid command code . routers/api/v1/api.go:6: running "sed": exit status 1 make: *** [generate] Error 1 ``` I'm on the latest version of OS X, and I'm not sure what to do from here.
Author
Owner

@sondr3 commented on GitHub (May 14, 2017):

Nevermind me, I reinstalled sed with Homebrew with brew install --with-default-names gnu-sed and it worked now.

@sondr3 commented on GitHub (May 14, 2017): Nevermind me, I reinstalled sed with Homebrew with `brew install --with-default-names gnu-sed` and it worked now.
Author
Owner

@bkcsoft commented on GitHub (Jun 15, 2017):

So is this still an issue? Or can we close this?

@bkcsoft commented on GitHub (Jun 15, 2017): So is this still an issue? Or can we close this?
Author
Owner

@lunny commented on GitHub (Jun 15, 2017):

It's still a problem when using default sed on macOS Sierra.

@lunny commented on GitHub (Jun 15, 2017): It's still a problem when using default sed on macOS Sierra.
Author
Owner

@sapk commented on GitHub (Jun 15, 2017):

The solution should be there https://stackoverflow.com/questions/2320564/variations-of-sed-between-osx-and-gnu-linux. I wil try to make a fix.

@sapk commented on GitHub (Jun 15, 2017): The solution should be there https://stackoverflow.com/questions/2320564/variations-of-sed-between-osx-and-gnu-linux. I wil try to make a fix.
Author
Owner

@sapk commented on GitHub (Jun 15, 2017):

Actually #1791 should also fix this by removing the go generate tag and using a separate make command.

@sapk commented on GitHub (Jun 15, 2017): Actually #1791 should also fix this by removing the go generate tag and using a separate make command.
Author
Owner

@appleboy commented on GitHub (Jun 15, 2017):

fixed by #1791 @lunny right?

@appleboy commented on GitHub (Jun 15, 2017): fixed by #1791 @lunny right?
Author
Owner

@lunny commented on GitHub (Jun 15, 2017):

Yes

@lunny commented on GitHub (Jun 15, 2017): Yes
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#686