Cli: Cannot Start New Project with Modules

Created on 13 Aug 2019  路  8Comments  路  Source: urfave/cli

I'm trying to use this in a new project (using go modules), but am receiving the following error. I also tried updating an existing project, but it failed with a similar error. This is on PopOS 19.04 (Ubuntu 19.04), go 1.12.7.

main.go:

package main

import (
    "gopkg.in/urfave/cli.v1"
    "log"
    "os"
)

func main() {
    err := cli.NewApp().Run(os.Args)
    if err != nil {
        log.Fatal(err)
    }
}
# go get gopkg.in/urfave/cli.v1
go: gopkg.in/urfave/[email protected]: go.mod has non-....v1 module path "github.com/urfave/cli" at revision v1.21.0
go: error loading module requirements

This worked with cli 1.20.0.

All 8 comments

You should use the github url, rather than gopkg.in. Whether that is right or not is debatable but it will address your issue.

馃憤 for using the GitHub URL, I have no idea how the gopkg.in url works

@AudriusButkevicius That does work, but like the documentation says, that'll cause issues when v2 becomes master.

This is the section I'm referring to: https://github.com/urfave/cli#pinning-to-the-v1-releases

The readme is outdated, pinning github has nothing to do with v1 vs v2

Got it. Mind if I make an issue for outdated docs?

A pr would be more welcome

I'd like to do a pr as well, but I think it'd just be me asking someone here what to put in. If that's ok, I can start that now.

@russoj88 yeah totally! go for it 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nkprince007 picture nkprince007  路  5Comments

lynncyrin picture lynncyrin  路  5Comments

lynncyrin picture lynncyrin  路  3Comments

errashe picture errashe  路  3Comments

vschettino picture vschettino  路  5Comments