dongrong7883 2019-07-05 07:17
浏览 43
已采纳

在为3rdparty / go / golang.org / x / text定义go_remote_library声明时遇到问题:*

I'm trying to used github.com/spf13/viper which requires github.com/spf13/afero and that requires some of the 3rdparty/go/golang.org/x/text: packages. Till afero works, and when defining 3rdparty BUILD for text:* packages I get the following errors,

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)

I tried to define it like this in 3rdparty/go/golang.org/x/text/BUILD,

go_remote_library(
    rev='342b2e1fbaa52c93f31447ad2c6abc048c63e475',
    packages=[
        'unicode/norm',
        'transform',
    ]
)

And it still shows the same error. Plus now running buildgen.go fails with the following error,

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']

Some more info, - Pants version: 1.13.0 - pantsbuild.pants.contrib.go: 1.13.0 - Tried using 1.14.0 & 1.15.0 as well and got the same results

Simple example to recreate it,

package main

import (
    "fmt"

    "github.com/spf13/viper"
)

func main() {
    viper.AutomaticEnv()
    fmt.Printf("%s", viper.GetString("HOME"))
}

Also you can simply do pants resolve on the package to get the error,

pants resolve 3rdparty/go/github.com/spf13/viper
  • 写回答

1条回答 默认 最新

  • douyun8674 2019-07-07 06:03
    关注

    Thanks to the pants team, got the issue resolved.

    buildgen.go does turn go_remote_library(pkg='foo') takes into go_remote_libraries targets. We need to use go_remote_libraries (not go_remote_library) to specify multiple packages.

    Using this works fine,

    go_remote_libraries(
      rev='342b2e1fbaa52c93f31447ad2c6abc048c63e475',
      packages=[
        'transform',
        'unicode/norm',
      ]
    )
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 lvgl V9移植到linux开发板
  • ¥15 VB.net中在窗体中创建一个button控件来关闭窗体,但是提示错误,我该怎么办
  • ¥15 网上下载好的程序但是arduinoIDE编程报错,运行不了,哪里出错了,能具体给改一下吗
  • ¥15 Sharepoint JS开发 付费技术指导
  • ¥15 输入程序运行仿真后,烟雾值不实时检测,变成固定值
  • ¥20 数据排序,可选择排序方向
  • ¥15 修改一下代码,考虑进程到达时间不同的情况
  • ¥15 帮我看看这是个啥题,带解题过程和结果,条件如下FCF = 290471.33 g1 = 15% r = 8% g2 = 4% n = 5
  • ¥15 edem模拟颗粒不显示或者生成失败
  • ¥15 Python代码编写