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

CLI is not go install-able #1389

Closed
marwan-at-work opened this issue Jul 18, 2020 · 12 comments · Fixed by #8204
Closed

CLI is not go install-able #1389

marwan-at-work opened this issue Jul 18, 2020 · 12 comments · Fixed by #8204
Labels
bug Something isn't working p3 Affects a small number of users or is largely cosmetic

Comments

@marwan-at-work
Copy link
Contributor

Due to the replace clause in the go.mod file of this repository, go get fails with the following errors:

go: found github.com/cli/cli/cmd/gh in github.com/cli/cli v0.11.0
# github.com/cli/cli/api
go/pkg/mod/github.com/cli/cli@v0.11.0/api/queries_issue.go:393:12: gql.MutateNamed undefined (type *graphql.Client has no field or method MutateNamed)
go/pkg/mod/github.com/cli/cli@v0.11.0/api/queries_issue.go:418:12: gql.MutateNamed undefined (type *graphql.Client has no field or method MutateNamed)
go/pkg/mod/github.com/cli/cli@v0.11.0/api/queries_repo.go:148:12: too many errors

I highly recommend either removing this replace clause here either by contributing the changes upstream or forking the repo and changing the import path.

Thanks!

@marwan-at-work marwan-at-work added the bug Something isn't working label Jul 18, 2020
@AliabbasMerchant
Copy link
Contributor

AFAIK, we are just focussing on being a command line program, and not a library/dependency/module for any external program, so go getting cli would not make sense

@marwan-at-work
Copy link
Contributor Author

marwan-at-work commented Jul 21, 2020

@AliabbasMerchant just FYI I wasn't trying to use it as a library or dependency. Go get is a common way to download and install Go programs that are executed as a binary

@AliabbasMerchant
Copy link
Contributor

Oh. Okay 👍

@vilmibm vilmibm added the p3 Affects a small number of users or is largely cosmetic label Sep 30, 2020
@Uzume
Copy link

Uzume commented Nov 20, 2020

The repo is already forked but there is another issue: cli/shurcooL-graphql@89ab2a8.

The added go.mod declares its module as github.com/shurcooL/graphql so it cannot be directly required as cli/shurcooL-graphql, thus the need for the replace directive here.

I created a pull request to get this fixed as referenced above.

Directly trying to push these kinds of changes upstream is already in progress, see:

@rogpeppe
Copy link

This issue prevents gh from being installed directly by using Go 1.16's go install:

% go install github.com/cli/cli/cmd/gh@v1.9.2
go: downloading github.com/cli/cli v1.9.2
go install: github.com/cli/cli/cmd/gh@v1.9.2 (in github.com/cli/cli@v1.9.2):
  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.

Given that it looks like the graphql upstream isn't being updated, and that the cli repository doesn't depend on anything external that itself depends on the graphql repository, it seems like it would be a reasonable idea to hard fork it, replacing all import paths as necessary.

@mislav
Copy link
Contributor

mislav commented Apr 27, 2021

@rogpeppe You are right; our upstream changes to graphql package are unlikely to get merged and we should hard-fork this dependency instead.

@NatoBoram
Copy link

It would be nice to be able to simply install it from go get. The package manager options available for Linux just aren't good.

go install github.com/cli/cli/v2/cmd/gh@latest

go install: github.com/cli/cli/v2/cmd/gh@latest (in github.com/cli/cli/v2@v2.2.0):
	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.

@Uzume
Copy link

Uzume commented Nov 17, 2021

It seems like the origin of this problem might finally be solved and this can be rectified here after this gets merged:

@myitcv
Copy link

myitcv commented Jan 8, 2022

Linking threads, this now appears to be blocked on #4731.

@myitcv
Copy link

myitcv commented Jan 8, 2022

This issue should also be retitled to something like:

"CLI is not go install-able"

because the de facto means of installing a Go program outside of a module context is now:

go install github.com/cli/cli/v2/cmd/gh@v2.4.0

(as mentioned in a couple of comments above)

@marwan-at-work marwan-at-work changed the title CLI is not go get-able CLI is not go install-able Jul 22, 2022
@marwan-at-work
Copy link
Contributor Author

@myitcv I renamed the issue. Also, the only replace statement I see the crypto library which at this point should also be hard-forked as I think that would make for a much better experience.

@myitcv
Copy link

myitcv commented Oct 18, 2023

Great works, thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p3 Affects a small number of users or is largely cosmetic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants