From ade50c7c36d5b6df337c3c4333bcfe02311f7ee8 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Tue, 16 May 2023 13:51:23 +0100 Subject: [PATCH] opentelemetry-collector{,-contrib}: move to cgo disabled and drop patch With gco disabled like upstream the patch to fix go-m1cpu becomes unnecessary --- .../misc/opentelemetry-collector/contrib.nix | 7 +-- .../misc/opentelemetry-collector/default.nix | 11 ++-- .../update_go-m1cpu_fix_aarch64-darwin.patch | 52 ------------------- 3 files changed, 9 insertions(+), 61 deletions(-) delete mode 100644 pkgs/tools/misc/opentelemetry-collector/update_go-m1cpu_fix_aarch64-darwin.patch diff --git a/pkgs/tools/misc/opentelemetry-collector/contrib.nix b/pkgs/tools/misc/opentelemetry-collector/contrib.nix index 7778ca59c89c..a544dbd44bcb 100644 --- a/pkgs/tools/misc/opentelemetry-collector/contrib.nix +++ b/pkgs/tools/misc/opentelemetry-collector/contrib.nix @@ -23,9 +23,10 @@ buildGoModule rec { # there is a nested go.mod sourceRoot = "source/cmd/otelcontribcol"; - # CGO_ENABLED=0 required for mac - "error: 'TARGET_OS_MAC' is not defined, evaluates to 0" - # https://github.com/shirou/gopsutil/issues/976 - CGO_ENABLED = if stdenv.isLinux then 1 else 0; + # upstream strongly recommends disabling CGO + # additionally dependencies have had issues when GCO was enabled that weren't caught upstream + # https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#using-cgo + CGO_ENABLED = 0; # journalctl is required in-$PATH for the journald receiver tests. nativeCheckInputs = lib.optionals stdenv.isLinux [ systemdMinimal ]; diff --git a/pkgs/tools/misc/opentelemetry-collector/default.nix b/pkgs/tools/misc/opentelemetry-collector/default.nix index 836f357ddfe3..dcca074e536a 100644 --- a/pkgs/tools/misc/opentelemetry-collector/default.nix +++ b/pkgs/tools/misc/opentelemetry-collector/default.nix @@ -15,13 +15,12 @@ buildGoModule rec { }; # there is a nested go.mod sourceRoot = "source/cmd/otelcorecol"; - vendorHash = "sha256-M1fLrQFrcfCRCcunkgEzUicVfi5Mz/Or6tFpcGfWf4E="; + vendorHash = "sha256-CXXv0GnMpebw2BWJz7Vvx7JfzPUIZ/zCrsmTgtMuvEw="; - patches = [ - # remove when fixed upstream - # https://github.com/open-telemetry/opentelemetry-collector/issues/7668 - ./update_go-m1cpu_fix_aarch64-darwin.patch - ]; + # upstream strongly recommends disabling CGO + # additionally dependencies have had issues when GCO was enabled that weren't caught upstream + # https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#using-cgo + CGO_ENABLED = 0; preBuild = '' # set the build version, can't be done via ldflags diff --git a/pkgs/tools/misc/opentelemetry-collector/update_go-m1cpu_fix_aarch64-darwin.patch b/pkgs/tools/misc/opentelemetry-collector/update_go-m1cpu_fix_aarch64-darwin.patch deleted file mode 100644 index 0a1ea9331b06..000000000000 --- a/pkgs/tools/misc/opentelemetry-collector/update_go-m1cpu_fix_aarch64-darwin.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/go.mod -+++ b/go.mod -@@ -19,7 +19,7 @@ require ( - go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.77.0 - go.opentelemetry.io/collector/receiver v0.77.0 - go.opentelemetry.io/collector/receiver/otlpreceiver v0.77.0 -- golang.org/x/sys v0.7.0 -+ golang.org/x/sys v0.8.0 - ) - - require ( -@@ -60,8 +60,8 @@ require ( - github.com/prometheus/procfs v0.9.0 // indirect - github.com/prometheus/statsd_exporter v0.22.7 // indirect - github.com/rs/cors v1.9.0 // indirect -- github.com/shirou/gopsutil/v3 v3.23.3 // indirect -- github.com/shoenig/go-m1cpu v0.1.4 // indirect -+ github.com/shirou/gopsutil/v3 v3.23.5-0.20230505121632-e045dc75ca1c // indirect -+ github.com/shoenig/go-m1cpu v0.1.6 // indirect - github.com/spf13/cobra v1.7.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/tklauser/go-sysconf v0.3.11 // indirect ---- a/go.sum -+++ b/go.sum -@@ -383,10 +383,18 @@ github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIH - github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= - github.com/shirou/gopsutil/v3 v3.23.3 h1:Syt5vVZXUDXPEXpIBt5ziWsJ4LdSAAxF4l/xZeQgSEE= - github.com/shirou/gopsutil/v3 v3.23.3/go.mod h1:lSBNN6t3+D6W5e5nXTxc8KIMMVxAcS+6IJlffjRRlMU= -+github.com/shirou/gopsutil/v3 v3.23.4 h1:hZwmDxZs7Ewt75DV81r4pFMqbq+di2cbt9FsQBqLD2o= -+github.com/shirou/gopsutil/v3 v3.23.4/go.mod h1:ZcGxyfzAMRevhUR2+cfhXDH6gQdFYE/t8j1nsU4mPI8= -+github.com/shirou/gopsutil/v3 v3.23.5-0.20230505121632-e045dc75ca1c h1:ZYIGwnQEbcRHlzQRm/ns8iJQgJU+drtg4cX39shs9lE= -+github.com/shirou/gopsutil/v3 v3.23.5-0.20230505121632-e045dc75ca1c/go.mod h1:LIiQgnFqJnplML7ahhMDo0wRqv6xMPNGNxGRDObehQ0= - github.com/shoenig/go-m1cpu v0.1.4 h1:SZPIgRM2sEF9NJy50mRHu9PKGwxyyTTJIWvCtgVbozs= - github.com/shoenig/go-m1cpu v0.1.4/go.mod h1:Wwvst4LR89UxjeFtLRMrpgRiyY4xPsejnVZym39dbAQ= -+github.com/shoenig/go-m1cpu v0.1.5/go.mod h1:Wwvst4LR89UxjeFtLRMrpgRiyY4xPsejnVZym39dbAQ= -+github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= -+github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= - github.com/shoenig/test v0.6.3 h1:GVXWJFk9PiOjN0KoJ7VrJGH6uLPnqxR7/fe3HUPfE0c= - github.com/shoenig/test v0.6.3/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= -+github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= - github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= - github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= - github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -@@ -627,6 +635,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= - golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= - golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= - golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -+golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -+golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= - golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= - golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= - golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=