isacikgoz / tldr

fast and interactive tldr client written with go
https://isacikgoz.me/tldr/
MIT License
1.36k stars 48 forks source link

compile error #44

Closed TorchedSammy closed 1 year ago

TorchedSammy commented 3 years ago

i tried to get tldr today and it resulted in this error:

# github.com/isacikgoz/tldr/cli
../../../go/src/github.com/isacikgoz/tldr/cli/default.go:44:33: cannot use list (type *"github.com/isacikgoz/gitin/prompt".SyncList) as type *"github.com/isacikgoz/gitin/prompt".List in argument to defaultExitMessage:
    *"github.com/isacikgoz/gitin/prompt".List is pointer to interface, not interface
../../../go/src/github.com/isacikgoz/tldr/cli/default.go:82:15: l.Items undefined (type *"github.com/isacikgoz/gitin/prompt".List is pointer to interface, not interface)

i ran go get github.com/isacikgoz/tldr/cmd/tldr

snowman commented 2 years ago

I have the same problem, how do you fix it?

snowman commented 2 years ago

I don't know about Golang, but apply following patch should work:

Save below patch to /tmp/fix-tldr.patch

diff --git a/cli/default.go b/cli/default.go
index d920831..e5b7aed 100644
--- a/cli/default.go
+++ b/cli/default.go
@@ -41,7 +41,7 @@ func NewDefaultPrompt(pgs []string, opts *prompt.Options, static, random bool) (
        prompt.WithInformation(information),
        prompt.WithSelectionHandler(d.selection),
    )
-   p.SetExitMsg(defaultExitMessage(list))
+   p.SetExitMsg(defaultExitMessage(nil))
    if static {
        if err := printStatic(page.Tips); err != nil {
            return nil, err
@@ -79,9 +79,10 @@ func (d *DefaultPrompt) selection(item interface{}) error {
 func defaultExitMessage(l *prompt.List) [][]term.Cell {
    var cells [][]term.Cell
    cells = append(cells, term.Cprint(""))
-   items, _ := l.Items()
-   for _, item := range items {
-       cells = append(cells, renderItem(item, nil, false)...)
-   }
-   return cells
+   // items, _ := l.Items()
+   // for _, item := range items {
+   //  cells = append(cells, renderItem(item, nil, false)...)
+   // }
+   // return cells
+   return nil
 }

Run command:

$ export HTTP_PROXY="http://127.0.0.1:10809"
$ export HTTPS_PROXY="$HTTP_PROXY"
$ go env -w GO111MODULE=off
$ go get -v github.com/isacikgoz/tldr/cmd/tldr
$ cd "$(go env GOPATH)/src/github.com/isacikgoz/tldr"
$ git apply /tmp/fix-tldr.patch
$ go run cmd/tldr/main.go

@isacikgoz would you mind to take a peek of it?

TorchedSammy commented 2 years ago

I'll try it again when I get home in a few hours if maintainer doesn't respond