looterz / grimd

:zap: fast dns proxy that can run anywhere, built to black-hole internet advertisements and malware servers
MIT License
1.38k stars 108 forks source link

Whether the compile parameter should enable `CGO` #91

Closed soulteary closed 2 years ago

soulteary commented 2 years ago

@looterz Hi 👋

I see a GitHub action is used in the build record with the CGO parameter enabled in the go env:

https://github.com/looterz/grimd/runs/5596926600?check_suite_focus=true

  CGO_ENABLED="1"
  GOMOD="/home/runner/work/grimd/grimd/go.mod"
  CGO_CFLAGS="-g -O2"
  CGO_CPPFLAGS=""
  CGO_CXXFLAGS="-g -O2"
  CGO_FFLAGS="-g -O2"
  CGO_LDFLAGS="-g -O2"
  PKG_CONFIG="pkg-config"

But in the Go Release config, I see the opposite config:

https://github.com/looterz/grimd/blob/master/.goreleaser.yaml

project_name: grimd
builds:
  - env: [CGO_ENABLED=0]

Which configuration should prevail? If community users want to submit some contributions to grimd, what is your suggestion?

Looking forward to your reply.

looterz commented 2 years ago

Hello,

I am not very familiar with the parameter. I accept any and all contributions to the project and try to review the submissions as quickly as possible.

Thanks for catching the configuration mismatch here, it looks like the setup-go action uses this as default in their build environment, likely for producing statically linked binaries? There seems to be different opinions on what to use (and dependencies can influence the decision), but as far as I am aware we don't have any issues with the releases, which have it set to 0.

soulteary commented 2 years ago

Thanks for such a quick reply, I'll do some testing later and report back to you.

This project is great, I decided to use it to replace my previous solution.

Thank you~