tsuru / tsuru-client

tsuru-client is a tsuru command line tool for application developers.
https://docs.tsuru.io/stable/
BSD 3-Clause "New" or "Revised" License
95 stars 77 forks source link

Client fails to install via go install #226

Closed mauri870 closed 4 months ago

mauri870 commented 4 months ago

Trying a go install github.com/tsuru/tsuru-client/tsuru@latest results in an error:

go: downloading github.com/tsuru/tsuru-client v0.0.0-20240612201434-2abeca466c57
go: github.com/tsuru/tsuru-client/tsuru@latest (in github.com/tsuru/tsuru-client@v0.0.0-20240612201434-2abeca466c57):
        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.

This happens because the go.mod contains replace directives:

https://github.com/tsuru/tsuru-client/blob/59bdc446b7780c9d529afcac7e337b6c2063a4ca/go.mod#L93-L96

See https://github.com/golang/go/issues/44840#issuecomment-1651863470 as to why replace directives should be avoided.

I understand the developers provide compiled releases, but go installable binaries have their advantages, for example:

mauri870 commented 4 months ago

From a brief investigation, looks like we can start with this:

# on tsuru and tsuru-client
gofmt -w -r '"github.com/ajg/form" -> "github.com/cezarsa/form"' .
go get github.com/cezarsa/form@v0.0.0-20210510165411-863b166467b9
# remove replace directives from go.mod
go mod tidy

The replace for dockerclient seems to be redundant since it is not in use according to go list -m all.

mauri870 commented 4 months ago

Looks like tsurud can be go installed after this as well :)

mauri870 commented 4 months ago

Just read the client docs and it was supposed to be go installable: https://tsuru.github.io/docs/user_guides/install_client/#building-from-source-code.

So this is actually a bug report and not a feature request.

mauri870 commented 4 months ago

cc @wpjunior

mauri870 commented 4 months ago

Both go run github.com/tsuru/tsuru-client/tsuru@latest and go run github.com/tsuru/tsuru/cmd/tsurud@latest work as intended now.

Closing this as completed by #227.