Skip to content

GO 编译时在此[golang:1.20-alpine]docker镜像内编译失败? #136

@admininfon

Description

@admininfon
shell: GOARCH=amd64 go build -o bin/hawk-grpc -ldflags "-s -w" .
  • Error:
package command-line-arguments
	imports hawk-rpc-go/config/viper
	imports hawk-rpc-go/config/qconf: build constraints exclude all Go files in /Users/kanghuixin/go/src/hawk-rpc-go/config/qconf

获取Qconf配置加载到viper组件内.

  • File:
    hawk-rpc-go/config/qconf/index.godriver/go/src/infra/go_qconf/go_qconf.go内容一致, 拷贝过来.

请查找下问题, 为啥忽略呢?

找到问题:

  1. 没有在该镜像编译安装QConf
  2. 没有加载cgo编译参数, 文件go_qconf.go import "C" 部分有注释说明, 添加 -L qconf -L m 参数

下面有追加镜像编译打包汇总.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions