Skip to content

Disable cgo in builds

What does this MR do and why?

Previously the binaries linked against glibc, but this doesn't appear to be necessary. Building a static binary avoids the need to worry about OS glibc versions.

Before:

$ file devfile-gem
devfile-gem: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=s8d8u7c2QXzZIDs0f9bl/ZfLMhEJU6bDKu2YuHSsR/sxofwIwe76xJ7nao8cid/cEJP0HV9k3bH_hfuYMyL, with debug_info, not stripped
$ ls -al devfile-gem
-rwxrwxr-x 1 stanhu stanhu 56737964 Apr 28 18:14 devfile-gem

After:

$ file devfile-gem
devfile-gem: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=4l-h5orWkdrrB5B29Kp4/tF6zfK51c0EEdUWgHQ3N/e-meKO3Pzg0zhEQdOWt1/SzYoZbQbZv6SFyUdzcg7, with debug_info, not stripped
$ ls -al devfile-gem
-rwxrwxr-x 1 stanhu stanhu 56653447 Apr 28 18:14 devfile-gem

This is only an 84,517 byte difference.

Relates to gitlab-org/gitlab#524856 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports

Loading