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 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题