我正在尝试使用需要 github.com/spf13/afero 并且需要一些 3rdparty/go/golang.org/x/text: 包的 github.com/spf13/viper。直到 afero 工作,并且在为 text:* 包定义 3rdparty BUILD 时,我收到以下错误,
3rdparty/go/github.com/spf13/afero has remote dependencies which require local declaration:
--> golang.org/x/text/unicode/norm (expected go_remote_library declaration at 3rdparty/go/golang.org/x/text:unicode/norm)
--> golang.org/x/text/transform (expected go_remote_library declaration at 3rdparty/go/golang.org/x/text:transform)
我试图在 3rdparty/go/golang.org/x/text/BUILD 中这样定义它,
go_remote_library(
rev='342b2e1fbaa52c93f31447ad2c6abc048c63e475',
packages=[
'unicode/norm',
'transform',
]
)
它仍然显示相同的错误。加上现在运行 buildgen.go 失败并出现以下错误,
Exception caught: (pants.build_graph.target.UnknownArgumentError) (backtrace omitted)
Exception message: Invalid target 3rdparty/go/golang.org/x/text:text: GoRemoteLibrary received unknown arguments:
packages = ['unicode/norm', 'transform']
更多信息, - 裤子版本:1.13.0 -pantsbuild.pants.contrib.go:1.13.0 - 也尝试使用 1.14.0 和 1.15.0 并得到相同的结果
重新创建它的简单示例,
package main
import (
"fmt"
"github.com/spf13/viper"
)
func main() {
viper.AutomaticEnv()
fmt.Printf("%s", viper.GetString("HOME"))
}
你也可以简单地在包装上做裤子解析来得到错误,
pants resolve 3rdparty/go/github.com/spf13/viper