Cannot `go run` because of `replace` directives in the go.mod file
kolypto opened this issue · comments
This is what happens when I try to use it as a tool:
$ docker run --rm -it golang
# go run github.com/hedhyw/json-log-viewer/cmd/jlv@latest
go: github.com/hedhyw/json-log-viewer/cmd/jlv@latest (in github.com/hedhyw/json-log-viewer@v0.2.4):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.
The reason is due to limitations in go run
vs go install
:
golang/go#44840
There're 2 replace directives:
It's possible to run in a different way:
git clone https://github.com/hedhyw/json-log-viewer
cd json-log-viewer
go run ./cmd/jlv
Reference: https://github.com/hedhyw/json-log-viewer?tab=readme-ov-file#source