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

Allow installation via go install #1698

Open
edthedev opened this issue May 20, 2024 · 5 comments
Open

Allow installation via go install #1698

edthedev opened this issue May 20, 2024 · 5 comments

Comments

@edthedev
Copy link

edthedev commented May 20, 2024

What should it do?

The current instructions to install via go get are deprecated in the recent versions of go.

Following the steps in README.md,
go get -u github.com/wtfutil/wtfgives this error:

go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
...

Running go install (which is a great way to install command line utilities) gives this error:

 $go install github.com/wtfutil/wtf@latest
go: downloading github.com/wtfutil/wtf v0.43.0
go: github.com/wtfutil/wtf@latest (in github.com/wtfutil/wtf@v0.43.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.

It would be terrific to be able to install wtfutil using go install. I have found it to be a reliable way to install command line utilities, in particular.

@edthedev
Copy link
Author

The go version that I got these errors from is:

$go version
go version go1.21.5 linux/amd64

@edthedev
Copy link
Author

Seems that go install takes issue with this line:

wtf/go.mod

Line 228 in 85b3568

replace github.com/wtfutil/todoist => github.com/Seanstoppable/todoist v0.0.0-20221214042915-6505286e6b1e

@edthedev
Copy link
Author

Git blame suggests
c327cd3
is relevant

@edthedev
Copy link
Author

Maybe dependent on (or blocked by?)
wtfutil/todoist#4
?

@edthedev
Copy link
Author

edthedev commented May 20, 2024

For what it's worth, forking and removing that line (and changing the first line) in go.mod allowed me to install.

$go install github.com/edthedev/wtf@ba90358
go: downloading github.com/edthedev/wtf v0.0.0-20240520021219-ba90358e748d
go: downloading github.com/logrusorgru/aurora/v4 v4.0.0
go: downloading github
...

But it did not result in the expected wtfutil appearing in ~/go/bin.

This seems likely to be related to:
https://stackoverflow.com/questions/26694271/go-install-doesnt-create-any-bin-file

(Essentially, go has a few more expectations about where main.go should be, if we want wtf to appear in ~/go/bin (on GOPATH).

edthedev added a commit to edthedev/dotfiles that referenced this issue Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant