Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib: add go.mod to isolate contribs confluentinc/confluent-kafka-go/kafka*, emicklei/go-restful/v3, gin-gonic/gin & globalsign/mgo #2379

Merged
merged 57 commits into from
Nov 24, 2023

Conversation

darccio
Copy link
Contributor

@darccio darccio commented Nov 23, 2023

What does this PR do?

Isolates the following contribs as independent modules:

  • confluentinc/confluent-kafka-go/kafka
  • confluentinc/confluent-kafka-go/kafka.v2
  • emicklei/go-restful/v3
  • gin-gonic/gin
  • globalsign/mgo

Also includes:

  • A script to automate the isolation of contribs, as it can be prone to human error. Mainly because go get tends to use the latest version available of a library and our contribs are not always pinned to the current one.
  • A new setup for contribs to be accessible as nested modules in a non-v1 major version because how nested modules work in monorepos:
    • Any nested module must be found in a subdirectory that matches the part of the module's path after the repository root path. Source: Go Modules Reference.
    • This means that for releasing nested modules in a v2 repository like github.com/DataDog/dd-trace-go/v2 they must be in a path starting with v2/ like v2/contrib/gin-gonic/gin for github.com/DataDog/dd-trace-go/v2/contrib/gin-gonic/gin.
    • This doesn't affect anything else that isn't a nested module.

This will be done for each contrib, and this is a first PR to validate the approach. Next PRs will consist of multiple contribs.

Motivation

Security scanners yield false positives, informing vulnerable versions that are present in the go.mod but not compiled into the final binary.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.

For Datadog employees:

  • If this PR touches code that handles credentials of any kind, such as Datadog API keys, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

@darccio darccio requested a review from a team November 23, 2023 17:15
@darccio darccio requested a review from a team as a code owner November 23, 2023 17:15
@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Nov 23, 2023
@darccio darccio changed the title contrib: add go.mod to isolate contribs contrib: add go.mod to isolate contribs confluentinc/confluent-kafka-go/kafka*, emicklei/go-restful/v3, gin-gonic/gin & globalsign/mgo Nov 23, 2023
@pr-commenter
Copy link

pr-commenter bot commented Nov 23, 2023

Benchmarks

Benchmark execution time: 2023-11-24 17:50:49

Comparing candidate commit 6650651 in PR branch dario.castane/AIT-8717/isolate-contribs-batch-2 with baseline commit 9d363fb in branch v2-dev.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 39 metrics, 2 unstable metrics.

@Julio-Guerra
Copy link

@darccio: I am wondering now if we will still be able to import our dd-trace-go internal packages from those sub-modules?

@darccio
Copy link
Contributor Author

darccio commented Nov 24, 2023

@darccio: I am wondering now if we will still be able to import our dd-trace-go internal packages from those sub-modules?

It is possible. I admit I was actually surprised when I checked it but the access rule to internal packages applies with submodules.

@darccio darccio force-pushed the dario.castane/AIT-8717/isolate-contribs-batch-2 branch from 9c2d469 to b4b17ae Compare November 24, 2023 15:00
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been updated according to this issue: googleapis/go-genproto#1015

@darccio
Copy link
Contributor Author

darccio commented Nov 24, 2023

CI is working flawlessly:

image
image
image

system-tests and appsec-go-test-app branches updated too.

image

@darccio darccio merged commit 9846c86 into v2-dev Nov 24, 2023
230 checks passed
@darccio darccio deleted the dario.castane/AIT-8717/isolate-contribs-batch-2 branch November 24, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ecosystem contrib/* related feature requests or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants