hedhyw / json-log-viewer

Interactive viewer for JSON logs.
MIT License
77 stars 7 forks source link

Cannot `go run` because of `replace` directives in the go.mod file #54

Closed kolypto closed 5 months ago

kolypto commented 5 months ago

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.
hedhyw commented 5 months ago

The reason is due to limitations in go run vs go install: https://github.com/golang/go/issues/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