apex / apex/up

If CGO is enabled, cross compilation fails with unhelpful error message.

Đang mở
#356 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
8.8k
Fork
383
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Prerequisites

* [x] I searched to see if the issue already exists.
* [x] I am running the latest version. (`up upgrade`)

```0.2.6```

* [x] I inspected the verbose debug output with the `-v, --verbose` flag.

```
Error: building: build hook: "GOOS=linux GOARCH=amd64 go build -o server *.go": # runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

## Description

If environment variable ```export CGO_ENABLED=1``` is set, Up will fail with a unhelpful error message. The reason is that Go tries to compile net/http using the CGO resolver.

"By default the pure Go resolver is used, because a blocked DNS request consumes only a goroutine, while a blocked C call consumes an operating system thread. When cgo is available, the cgo-based resolver is used instead under a variety of conditions"

https://golang.org/pkg/net/

## Steps to Reproduce

[0] Using a Macbook Pro & OSX

[1] ```$ export CGO_ENABLED=1```

[2] clone the golang Up api example

[3] run ```$ up``` in project directory

## Love Up?

❤️

## Solution

Check if CGO is enabled at compile time and warn? Fail?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.