From f996399f27cadbcdc6b88547a6ade0019276a281 Mon Sep 17 00:00:00 2001 From: Sheridan C Rawlins Date: Mon, 18 Nov 2024 15:52:06 -0800 Subject: [PATCH] In order to protect users of prebid-server that don't use CGO, add build flag. --- .../devicedetection/account_info_extractor.go | 2 ++ .../devicedetection/account_info_extractor_test.go | 2 ++ .../devicedetection/account_validator.go | 2 ++ .../devicedetection/account_validator_test.go | 2 ++ modules/fiftyonedegrees/devicedetection/config.go | 2 ++ .../fiftyonedegrees/devicedetection/config_test.go | 2 ++ modules/fiftyonedegrees/devicedetection/context.go | 2 ++ .../devicedetection/device_detector.go | 2 ++ .../devicedetection/device_detector_test.go | 2 ++ .../devicedetection/device_info_extractor.go | 2 ++ .../devicedetection/device_info_extractor_test.go | 2 ++ .../devicedetection/evidence_extractor.go | 2 ++ .../devicedetection/evidence_extractor_test.go | 2 ++ .../devicedetection/fiftyone_device_types.go | 2 ++ .../devicedetection/fiftyone_device_types_test.go | 2 ++ .../devicedetection/hook_auction_entrypoint.go | 2 ++ .../devicedetection/hook_raw_auction_request.go | 2 ++ modules/fiftyonedegrees/devicedetection/models.go | 2 ++ .../fiftyonedegrees/devicedetection/models_test.go | 2 ++ modules/fiftyonedegrees/devicedetection/module.go | 2 ++ .../fiftyonedegrees/devicedetection/module_test.go | 2 ++ modules/fiftyonedegrees/devicedetection/no_cgo.go | 13 +++++++++++++ .../devicedetection/request_headers_extractor.go | 2 ++ .../request_headers_extractor_test.go | 2 ++ .../devicedetection/sua_payload_extractor.go | 2 ++ 25 files changed, 61 insertions(+) create mode 100644 modules/fiftyonedegrees/devicedetection/no_cgo.go diff --git a/modules/fiftyonedegrees/devicedetection/account_info_extractor.go b/modules/fiftyonedegrees/devicedetection/account_info_extractor.go index 2a5168cfe0c..3961ec11373 100644 --- a/modules/fiftyonedegrees/devicedetection/account_info_extractor.go +++ b/modules/fiftyonedegrees/devicedetection/account_info_extractor.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/account_info_extractor_test.go b/modules/fiftyonedegrees/devicedetection/account_info_extractor_test.go index 2d32f7915b5..76cb543c016 100644 --- a/modules/fiftyonedegrees/devicedetection/account_info_extractor_test.go +++ b/modules/fiftyonedegrees/devicedetection/account_info_extractor_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/account_validator.go b/modules/fiftyonedegrees/devicedetection/account_validator.go index fdff92531a7..169850e551f 100644 --- a/modules/fiftyonedegrees/devicedetection/account_validator.go +++ b/modules/fiftyonedegrees/devicedetection/account_validator.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import "slices" diff --git a/modules/fiftyonedegrees/devicedetection/account_validator_test.go b/modules/fiftyonedegrees/devicedetection/account_validator_test.go index 25f99e3b796..b3c943bf5a8 100644 --- a/modules/fiftyonedegrees/devicedetection/account_validator_test.go +++ b/modules/fiftyonedegrees/devicedetection/account_validator_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/config.go b/modules/fiftyonedegrees/devicedetection/config.go index a5c302bcff5..bcf61746d2d 100644 --- a/modules/fiftyonedegrees/devicedetection/config.go +++ b/modules/fiftyonedegrees/devicedetection/config.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/config_test.go b/modules/fiftyonedegrees/devicedetection/config_test.go index e2478d82b7d..9775eb7a100 100644 --- a/modules/fiftyonedegrees/devicedetection/config_test.go +++ b/modules/fiftyonedegrees/devicedetection/config_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/context.go b/modules/fiftyonedegrees/devicedetection/context.go index 3c10dd2f393..b16495ef1fd 100644 --- a/modules/fiftyonedegrees/devicedetection/context.go +++ b/modules/fiftyonedegrees/devicedetection/context.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection // Context keys for device detection diff --git a/modules/fiftyonedegrees/devicedetection/device_detector.go b/modules/fiftyonedegrees/devicedetection/device_detector.go index 8369d343d34..39f086ea164 100644 --- a/modules/fiftyonedegrees/devicedetection/device_detector.go +++ b/modules/fiftyonedegrees/devicedetection/device_detector.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/device_detector_test.go b/modules/fiftyonedegrees/devicedetection/device_detector_test.go index 84d6ab28cc0..c113aec7acf 100644 --- a/modules/fiftyonedegrees/devicedetection/device_detector_test.go +++ b/modules/fiftyonedegrees/devicedetection/device_detector_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/device_info_extractor.go b/modules/fiftyonedegrees/devicedetection/device_info_extractor.go index 1c913e21696..c1d185b860e 100644 --- a/modules/fiftyonedegrees/devicedetection/device_info_extractor.go +++ b/modules/fiftyonedegrees/devicedetection/device_info_extractor.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/device_info_extractor_test.go b/modules/fiftyonedegrees/devicedetection/device_info_extractor_test.go index 197e3928602..23bee8a5d56 100644 --- a/modules/fiftyonedegrees/devicedetection/device_info_extractor_test.go +++ b/modules/fiftyonedegrees/devicedetection/device_info_extractor_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/evidence_extractor.go b/modules/fiftyonedegrees/devicedetection/evidence_extractor.go index a99a921e75f..2a3d36a98bc 100644 --- a/modules/fiftyonedegrees/devicedetection/evidence_extractor.go +++ b/modules/fiftyonedegrees/devicedetection/evidence_extractor.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/evidence_extractor_test.go b/modules/fiftyonedegrees/devicedetection/evidence_extractor_test.go index 6b2f9b3ea85..7dc4fb97901 100644 --- a/modules/fiftyonedegrees/devicedetection/evidence_extractor_test.go +++ b/modules/fiftyonedegrees/devicedetection/evidence_extractor_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/fiftyone_device_types.go b/modules/fiftyonedegrees/devicedetection/fiftyone_device_types.go index 7237698117d..2c95bc98e22 100644 --- a/modules/fiftyonedegrees/devicedetection/fiftyone_device_types.go +++ b/modules/fiftyonedegrees/devicedetection/fiftyone_device_types.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/fiftyone_device_types_test.go b/modules/fiftyonedegrees/devicedetection/fiftyone_device_types_test.go index 5fd0203bac8..f8b91678a0b 100644 --- a/modules/fiftyonedegrees/devicedetection/fiftyone_device_types_test.go +++ b/modules/fiftyonedegrees/devicedetection/fiftyone_device_types_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/hook_auction_entrypoint.go b/modules/fiftyonedegrees/devicedetection/hook_auction_entrypoint.go index 7597daa8e00..8be51c422df 100644 --- a/modules/fiftyonedegrees/devicedetection/hook_auction_entrypoint.go +++ b/modules/fiftyonedegrees/devicedetection/hook_auction_entrypoint.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/hook_raw_auction_request.go b/modules/fiftyonedegrees/devicedetection/hook_raw_auction_request.go index 88d0686905d..acde532eb52 100644 --- a/modules/fiftyonedegrees/devicedetection/hook_raw_auction_request.go +++ b/modules/fiftyonedegrees/devicedetection/hook_raw_auction_request.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/models.go b/modules/fiftyonedegrees/devicedetection/models.go index c58daa211fd..ffa98872353 100644 --- a/modules/fiftyonedegrees/devicedetection/models.go +++ b/modules/fiftyonedegrees/devicedetection/models.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection // Prefixes in literal format diff --git a/modules/fiftyonedegrees/devicedetection/models_test.go b/modules/fiftyonedegrees/devicedetection/models_test.go index 898f25f4144..a2a251f425f 100644 --- a/modules/fiftyonedegrees/devicedetection/models_test.go +++ b/modules/fiftyonedegrees/devicedetection/models_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/module.go b/modules/fiftyonedegrees/devicedetection/module.go index 80eed36efda..a4c459a78fc 100644 --- a/modules/fiftyonedegrees/devicedetection/module.go +++ b/modules/fiftyonedegrees/devicedetection/module.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/module_test.go b/modules/fiftyonedegrees/devicedetection/module_test.go index eb59d01359e..19595aca4e1 100644 --- a/modules/fiftyonedegrees/devicedetection/module_test.go +++ b/modules/fiftyonedegrees/devicedetection/module_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/no_cgo.go b/modules/fiftyonedegrees/devicedetection/no_cgo.go new file mode 100644 index 00000000000..ecdbe31dbdc --- /dev/null +++ b/modules/fiftyonedegrees/devicedetection/no_cgo.go @@ -0,0 +1,13 @@ +//go:build !cgo + +package devicedetection + +import ( + "encoding/json" + + "github.com/prebid/prebid-server/v2/modules/moduledeps" +) + +func Builder(rawConfig json.RawMessage, _ moduledeps.ModuleDeps) (interface{}, error) { + panic("Not implemented when CGO_ENABLED=0") +} diff --git a/modules/fiftyonedegrees/devicedetection/request_headers_extractor.go b/modules/fiftyonedegrees/devicedetection/request_headers_extractor.go index 8440886b353..7e36efa2956 100644 --- a/modules/fiftyonedegrees/devicedetection/request_headers_extractor.go +++ b/modules/fiftyonedegrees/devicedetection/request_headers_extractor.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/request_headers_extractor_test.go b/modules/fiftyonedegrees/devicedetection/request_headers_extractor_test.go index 77fbed3a42f..8cde22c89d8 100644 --- a/modules/fiftyonedegrees/devicedetection/request_headers_extractor_test.go +++ b/modules/fiftyonedegrees/devicedetection/request_headers_extractor_test.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import ( diff --git a/modules/fiftyonedegrees/devicedetection/sua_payload_extractor.go b/modules/fiftyonedegrees/devicedetection/sua_payload_extractor.go index ab69210449f..967ef24d93e 100644 --- a/modules/fiftyonedegrees/devicedetection/sua_payload_extractor.go +++ b/modules/fiftyonedegrees/devicedetection/sua_payload_extractor.go @@ -1,3 +1,5 @@ +//go:build cgo + package devicedetection import (