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

isolate nlopt dependency further by moving inject.motion_service.go to its own package #4907

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

raybjork
Copy link
Member

Currently when someone tries to import anything in the inject package (for example if they are writing unit tests for their module) they are forced to import nlopt too. This PR creates a separate package for injected motion so that this only is required when someone goes to import inject/motion rather than just inject.

This is the cleanest solution I thought of but looking for sign off from @cheukt since it is a departure from how we have structured RDK so far.

@raybjork raybjork requested review from cheukt and JohnN193 April 10, 2025 18:28
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Apr 10, 2025
@@ -6,7 +6,7 @@ import (
"strconv"

"github.com/golang/geo/r3"
protov1 "github.com/golang/protobuf/proto" //nolint:staticcheck
protov1 "github.com/golang/protobuf/proto"
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this was added by the linter

@@ -462,13 +461,6 @@ func TestManagerAdd(t *testing.T) {
test.That(t, err, test.ShouldBeNil)
test.That(t, resource1, test.ShouldEqual, injectBoard)

injectMotionService := &inject.MotionService{}
Copy link
Member Author

Choose a reason for hiding this comment

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

This part of the test does not seem to add anything and means that anyone importing resource also needs to import nlopt by transitive dependencies (although the reason resource is importing this is unclear to me)

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Apr 10, 2025
Copy link
Member

@JohnN193 JohnN193 left a comment

Choose a reason for hiding this comment

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

tested with a module that uses injects and found that nlopt was no longer being imported! thanks for the quick change

@JohnN193
Copy link
Member

tested with a module that uses injects and found that nlopt was no longer being imported! thanks for the quick change

actually quickish q, nlopt is no longer in the go.mod but it still appears in the go.sum for my modules. Would that still cause build issues?

Copy link
Member

@cheukt cheukt left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants