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

Couldn't run make build? #3

Open
sgalcheung opened this issue May 8, 2024 · 0 comments
Open

Couldn't run make build? #3

sgalcheung opened this issue May 8, 2024 · 0 comments

Comments

@sgalcheung
Copy link

When I git clone this repo and make a build, some issues occur

/pubstore/build go install ./cmd/pubstore/pubstore.go
/bin/sh: 工作(Work): No such file or directory
make: *** [cmd/pubstore/pubstore.go] Error 1

After reach I found this problem:
The GOPATH setting method in this Makefile is based on the old Go project management method, which uses GOPATH. In modern Go development, it is recommended to use Go Modules to manage dependencies without the need to set GOPATH.

So, I update this Makefile

ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

BUILD_DIR=$(ROOT_DIR)/build

rm=rm -rf

pubstore=cmd/pubstore/pubstore.go

swag=~/go/bin/swag

.PHONY: all clean $(pubstore) test docs run

all: $(pubstore)

clean:
    $(rm)  $(BUILD_DIR)

test:
    go test -coverpkg=./pkg/./... ./pkg/./...

build: $(pubstore)

docs:
    $(swag) init -g router.go -d pkg/api -o pkg/docs

$(pubstore):
    go install ./$@

run:
    go run $(pubstore)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant