douba4933
2018-01-30 09:01
浏览 685

golang.org/x/sys/unix缺少功能主体的问题

bitbucket-pipelines.yml:

image: golang:1.9

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - PACKAGE_PATH="${GOPATH}/src/bitbucket.org/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}"
          - mkdir -pv "${PACKAGE_PATH}"
          - tar -cO --exclude-vcs --exclude=bitbucket-pipelines.yml . | tar -xv -C "${PACKAGE_PATH}"
          - cd "${PACKAGE_PATH}"
          - go version
          - uname -a
          - make build_linux
          - go test -v ./...`enter code here`

I try to build Golang app on Bitbucket CI but got the error with golang.org/x/sys/unix:

make build_linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --tags "json1" -ldflags "-s -X main.version=0.63" -a -installsuffix cgo -o dbcore_linux ./cmd/dbcore/dbcore.go
# bitbucket.org/xxx/dbcore/vendor/golang.org/x/sys/unix
vendor/golang.org/x/sys/unix/syscall_linux.go:20:6: missing function body
vendor/golang.org/x/sys/unix/syscall_linux.go:24:6: missing function body
vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go:13:6: missing function body
vendor/golang.org/x/sys/unix/syscall_unix_gc.go:12:6: missing function body
vendor/golang.org/x/sys/unix/syscall_unix_gc.go:13:6: missing function body
vendor/golang.org/x/sys/unix/syscall_unix_gc.go:14:6: missing function body
vendor/golang.org/x/sys/unix/syscall_unix_gc.go:15:6: missing function body
make: *** [build_linux] Error 2
Makefile:7: recipe for target 'build_linux' failed

Dockerfile: https://github.com/docker-library/golang/blob/2f2f3b620d61f533484f24a568c2ca46e4fda91c/1.9/stretch/Dockerfile

I haven't issue on the local machine with MacOS. Only CI. How could I resolve that issue?

Thanks!

图片转代码服务由CSDN问答提供 功能建议

bitbucket-pipelines.yml:

  image:golang:  1.9 
 
管道:
默认值:
-步骤:
脚本:#修改以下命令以构建存储库。
-PACKAGE_PATH =“ $ {GOPATH} /src/bitbucket.org / $ {BITBUCKET_REPO_OWNER}  / $ {BITBUCKET_REPO_SLUG}“ 
-mkdir -pv” $ {PACKAGE_PATH}“ 
-tar -cO --exclude-vcs --exclude = bitbucket-pipelines.yml。  |  tar -xv -C“ $ {PACKAGE_PATH}” 
-cd“ $ {PACKAGE_PATH}” 
-转到版本
-uname -a 
-生成build_linux 
-进行测试-v。/ ...` 在这里输入代码`
   
 
 

我尝试在Bitbucket CI上构建Golang应用,但golang.org/x/sys/unix出现了错误: \ n

  make build_linux 
CGO_ENABLED = 0 GOOS = linux GOARCH = amd64 go build --tags“ json1” -ldflags“ -s -X main.version = 0.63” -a -installsuffix cgo -o dbcore_linux  ./cmd/dbcore/dbcore.go
# bitbucket.org/xxx/dbcore/vendor/golang.org/x/sys/unix
vendor/golang.org/x/sys/unix/syscall_linux.go:20:  6:缺少函数主体
vendor / golang.org / x / sys / unix / syscall_linux.go:24:6:缺少函数主体
vendor / golang.org / x / sys / unix / syscall_linux_amd64_gc.go:13:6: 缺少功能正文
vendor / golang.org / x / sys / unix / syscall_unix_gc.go:12:6:缺少功能正文
vendor / golang.org / x / sys / unix / syscall_unix_gc.go:13:6:缺少功能 body 
vendor / golang.org / x / sys / unix / syscall_unix_gc.go:14:6:缺少乐趣 正文
vendor / golang.org / x / sys / unix / syscall_unix_gc.go:15:6:缺少函数正文
make:*** [build_linux]错误2 
Makefile:7:目标“ build_linux”的配方失败\  n   
 
 

Dockerfile: https://github.com/docker-library/golang/blob/2f2f3b620d61f533484f24a568c2ca46e4fda91c/1.9/stretch/Dockerfile

我还没有发布 使用MacOS的本地计算机。 只有CI。 我该如何解决该问题?

谢谢!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • donglong1465 2018-01-30 15:18
    已采纳

    Golang dep command copy many files to the vendor folder which I wanted to skip with .gitignore rules, so .s files had been also skipped for vendor/golang.org/x/sys/ dep.

    Issue disappear after I exclude *.s files from .gitignore.

    点赞 评论

相关推荐 更多相似问题