wtfutil / wtf

The personal information dashboard for your terminal
http://wtfutil.com
Mozilla Public License 2.0
15.89k stars 805 forks source link

Allow installation via `go install` #1698

Open edthedev opened 6 months ago

edthedev commented 6 months ago

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 commented 6 months ago

The go version that I got these errors from is:

$go version
go version go1.21.5 linux/amd64
edthedev commented 6 months ago

Seems that go install takes issue with this line:

https://github.com/wtfutil/wtf/blob/85b3568ad31d45bc0eb0c46c91d319621427208c/go.mod#L228

edthedev commented 6 months ago

Git blame suggests https://github.com/wtfutil/wtf/commit/c327cd3bf1087d33a2c8f706da11f0fc087e06dc is relevant

edthedev commented 6 months ago

Maybe dependent on (or blocked by?) https://github.com/wtfutil/todoist/pull/4 ?

edthedev commented 6 months ago

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).

stale[bot] commented 1 week ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

eabase commented 6 days ago

Please disable that ⬆️ stale bot. 💩

To install, use: go install github.com/wtfutil/wtf@latest