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

$ go get failed because of "cli" package dependency #39

Closed
kasumits opened this issue Dec 24, 2019 · 4 comments · Fixed by #40
Closed

$ go get failed because of "cli" package dependency #39

kasumits opened this issue Dec 24, 2019 · 4 comments · Fixed by #40

Comments

@kasumits
Copy link

When I tried to install this product with command $ go get github.com/motemen/blogsync, or $ cd ${GOPATH}/src/github.com/motemen/blogsync && go build -o blogsync after cloning this git repository, the following error has occurred, regardless of where the installation was tried, such as on my local machine(WindowsPowerShell) or on remote host(CircleCI-GoContainer).

C:\Users\***\go\src\github.com\motemen\blogsync\main.go:17:15: cannot use []cli.Command literal (type []cli.Command) as type []*cli.Command in assignment
C:\Users\***\go\src\github.com\motemen\blogsync\main.go:157:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in array or slice literal:
        cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
C:\Users\***\go\src\github.com\motemen\blogsync\main.go:158:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
        cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
C:\Users\***\go\src\github.com\motemen\blogsync\main.go:159:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
        cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
$ #!/bin/bash -eo pipefail
cd ${GOPATH}/src/github.com/motemen/blogsync && go build -o blogsync
# github.com/motemen/blogsync
./main.go:17:15: cannot use []cli.Command literal (type []cli.Command) as type []*cli.Command in assignment
./main.go:157:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in array or slice literal:
    cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
./main.go:158:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
    cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
./main.go:159:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
    cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)

Exited with code exit status 2

I guess that the dependency between main.go and urfave/cli, which is mentioned as one of imported packages in main.go, leads this error. For your information, urfave/cli branched off in autumn 2019, and now there are two versions of that component, then import method written below may result in installation of urfave/cli/v1.

import (
	"github.com/urfave/cli"
)

cf. https://github.com/urfave/cli
cf. swaggo/swag#556

So I want to let you know the phenomenon, and I hope you would fix this issue.

Best regards.

@Songmu
Copy link
Member

Songmu commented Dec 24, 2019

May be resolved at #40. Please try it. Thanks for reporting!

@kasumits
Copy link
Author

Thank you for your quick acknowledgement and operation.

I've retried $ go get on remote host(CircleCI), then the most part of the problem has been treated successfully, but the rest hasn't been fixed yet.

#!/bin/bash -eo pipefail
go get github.com/motemen/blogsync
# github.com/motemen/blogsync
/home/circleci/go/src/github.com/motemen/blogsync/main.go:17:15: cannot use []cli.Command literal (type []cli.Command) as type []*cli.Command in assignment

Exited with code exit status 2

Another fix, maybe on ll.17-22 of main.go sited below, may be needed.

	app.Commands = []cli.Command{
		commandPull,
		commandPush,
		commandPost,
		commandList,
	}

So I want to ask a favor of you to reopen this issue.
Sorry for insufficiency of my previous indication.

Best regards.

@Songmu
Copy link
Member

Songmu commented Dec 25, 2019

Sorry for my incomplete fix. I’ll fix later.

@Songmu Songmu reopened this Dec 25, 2019
@Songmu
Copy link
Member

Songmu commented Dec 25, 2019

I fixed code at #41 and blogsync now depends latest urfave/cli (v2.1.0).

However, due to this change, blogsync only works with go modules. Therefore, if you want to install blogsync with "go get", please set environment variable GO111MODULE "on" and get it with go 1.13 or later.

Alternatively, you can get built binaries from GitHub Releases and use that. If you just want to use the blogsync command, it is certain in many cases.

@Songmu Songmu closed this as completed Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants