douyi4544 2016-12-09 02:33
浏览 12
已采纳

为什么以下导入无效?

Why the following works

package main

import (
    "os"

    cli "github.com/urfave/cli"
)

func main() {
    cli.NewApp().Run(os.Args)
}

but when I change the cli import to following as suggested in https://github.com/urfave/cli

import (
        "os"

        cli "gopkg.in/urfave/cli.v2"
    )

It gives this error undefined: cli.NewApp

  • 写回答

2条回答 默认 最新

  • drygauost253590142 2016-12-09 02:54
    关注

    v2 of the package has no NewApp() method.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?