pyroscope icon indicating copy to clipboard operation
pyroscope copied to clipboard

Can't install profilecli with 'go install'

Open hairyhenderson opened this issue 2 years ago • 6 comments

Describe the bug

I wanted to install profilecli locally, and the first way I thought of was to use go install, but that failed because of the replace directives.

To Reproduce

Steps to reproduce the behavior:

  1. $ go install github.com/grafana/phlare/cmd/profilecli@latest
    go: downloading github.com/grafana/phlare v0.5.1
    go: github.com/grafana/phlare/cmd/profilecli@latest (in github.com/grafana/[email protected]):
            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.
    

Expected behavior

I expected that command to succeed...

Environment

  • Infrastructure: local (desktop)
  • Deployment tool: n/a

Additional Context

A simple workaround is to just download the pre-built binaries from the release page

hairyhenderson avatar Mar 07 '23 17:03 hairyhenderson

Could you please try go install github.com/grafana/phlare/cmd/profilecli? It works for me.

0xPoe avatar Mar 08 '23 01:03 0xPoe

$ go install github.com/grafana/phlare/cmd/profilecli@latest
go: downloading github.com/grafana/phlare v0.5.1
go: github.com/grafana/phlare/cmd/profilecli@latest (in github.com/grafana/[email protected]):
        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 is a restriction when you have version suffixes.

0xPoe avatar Mar 08 '23 01:03 0xPoe

in a clean environment (golang:1.20 Docker image):

root@dfc43b015469:~# go install github.com/grafana/phlare/cmd/profilecli
go: 'go install' requires a version when current directory is not in a module
        Try 'go install github.com/grafana/phlare/cmd/profilecli@latest' to install the latest version

In other words - @latest is required in order to compile/install a binary for general use

hairyhenderson avatar Mar 08 '23 12:03 hairyhenderson

in a clean environment (golang:1.20 Docker image):

root@dfc43b015469:~# go install github.com/grafana/phlare/cmd/profilecli
go: 'go install' requires a version when current directory is not in a module
        Try 'go install github.com/grafana/phlare/cmd/profilecli@latest' to install the latest version

In other words - @latest is required in order to compile/install a binary for general use

Oops. Sorry for the unclear. Could you please try cloning the repo and try go install github.com/grafana/phlare/cmd/profilecli in your repo directory? I think it would work.

0xPoe avatar Mar 09 '23 00:03 0xPoe

@cyriltovena As this is a workaround. I think we can close this issue now.

0xPoe avatar Apr 17 '23 02:04 0xPoe

I just tried to go install github.com/grafana/pyroscope/cmd/profilecli@latest and now it's erroring because there are replace lines in the go.mod:

$ go install github.com/grafana/pyroscope/cmd/profilecli@latest
go: github.com/grafana/pyroscope/cmd/profilecli@latest (in github.com/grafana/[email protected]):
        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.

I came to file a new issue but found this one that I'd forgotten about 😅

hairyhenderson avatar Nov 26 '25 13:11 hairyhenderson