Use 'go run' for swag in Makefile if not on PATH

This commit is contained in:
Evan Goode 2025-02-27 20:24:00 -05:00
parent 7578349442
commit 0460a72121
3 changed files with 4 additions and 5 deletions

View File

@ -1,11 +1,14 @@
prefix ?= /usr
.DEFAULT_GOAL := build
# TODO probably use `go tool` for this eventually
SWAG := $(shell command -v swag || echo 'go run github.com/swaggo/swag/cmd/swag@v1.16.4')
npm-install:
npm install
swag:
swag init --generalInfo api.go --output . --outputTypes json
$(SWAG) init --generalInfo api.go --output . --outputTypes json
prebuild: npm-install swag
node esbuild.config.js

View File

@ -91,8 +91,6 @@ Otherwise, install build dependencies. Go 1.19 or later is required:
sudo apt install make golang gcc nodejs npm # Debian
sudo dnf install make golang gcc nodejs npm # Fedora
sudo pacman -S make go gcc nodejs npm # Arch Linux
go install github.com/swaggo/swag/cmd/swag@latest
```
Then build the program with:

View File

@ -140,8 +140,6 @@ This is a more declarative version of the Docker setup from above.
sudo apt install make golang gcc nodejs npm # Debian
sudo dnf install make golang gcc nodejs npm # Fedora
sudo pacman -S make go gcc nodejs npm # Arch Linux
go install github.com/swaggo/swag/cmd/swag@latest
```
2. Clone the repository: