亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

安裝 go 風景 - 無法使用 &SceneryDefinition

安裝 go 風景 - 無法使用 &SceneryDefinition

Go
蠱毒傳說 2022-07-18 16:20:43
我已經安裝好了。但是,當我這樣做時:go get -u github.com/dmlittle/scenery我得到:# github.com/dmlittle/scenery/pkg/parsergo/src/github.com/dmlittle/scenery/pkg/parser/parser.go:98:20: cannot use &SceneryDefinition literal (type *SceneryDefinition) as type lexer.Definition in argument to participle.Lexer:    *SceneryDefinition does not implement lexer.Definition (wrong type for Lex method)        have Lex(io.Reader) (lexer.Lexer, error)        want Lex(string, io.Reader) (lexer.Lexer, error)go/src/github.com/dmlittle/scenery/pkg/parser/parser.go:116:21: not enough arguments in call to p.ParseString    have (string, *Plan)    want (string, string, interface {}, ...participle.ParseOption)go/src/github.com/dmlittle/scenery/pkg/parser/scanner.go:39:10: undefined: lexer.Errorfgo/src/github.com/dmlittle/scenery/pkg/parser/scanner.go:82:26: undefined: lexer.Errorf有什么建議么?
查看完整描述

1 回答

?
瀟湘沐

TA貢獻1816條經驗 獲得超6個贊

同樣的問題,似乎prj使用dep。我已經修復了克隆 repo,然后配置 go 模塊以找到正確的項目依賴項。然后再次運行 go get ,構建成功:


~/go/src/github.com/dmlittle/scenery (master ?) ? go run main.go

# github.com/dmlittle/scenery/pkg/parser

pkg/parser/parser.go:98:20: cannot use &SceneryDefinition literal (type *SceneryDefinition) as type lexer.Definition in argument to participle.Lexer:

    *SceneryDefinition does not implement lexer.Definition (wrong type for Lex method)

        have Lex(io.Reader) (lexer.Lexer, error)

        want Lex(string, io.Reader) (lexer.Lexer, error)

pkg/parser/parser.go:116:21: not enough arguments in call to p.ParseString

    have (string, *Plan)

    want (string, string, interface {}, ...participle.ParseOption)

pkg/parser/scanner.go:39:10: undefined: lexer.Errorf

pkg/parser/scanner.go:82:26: undefined: lexer.Errorf

初始化 go mod:


~/go/src/github.com/dmlittle/scenery (master ?) ? go mod init

go: creating new go.mod: module github.com/dmlittle/scenery

go: copying requirements from Gopkg.lock

檢查依賴項:


go mod tidy

go: downloading github.com/spf13/cobra v0.0.3

go: downloading github.com/fatih/color v1.7.0

....

安裝包:


go get -u github.com/dmlittle/scenery

按預期工作:


~/go/src/github.com/dmlittle/scenery (master ?)? ? ./scenery

Usage:

  scenery [flags]


Examples:

  terraform plan | scenery


Flags:

  -h, --help       help for scenery

  -n, --no-color   Print output without color

      --version    version for scenery


查看完整回答
反對 回復 2022-07-18
  • 1 回答
  • 0 關注
  • 113 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號