tiiuae / rclgo

ROS Client Library for Golang
Apache License 2.0
81 stars 14 forks source link

rclgo-gen: Autodetect message-module-prefix #5

Closed lime008 closed 2 years ago

lime008 commented 2 years ago

When the generator is run inside of a go module it'll read the full package path and use that as the message-module-prefix. It'll fall back to the default value specified if the package name check fails.

destPath can be used to modify the prefix if the generated output differs from the current directory the generator is running.

Example

package example // import "example.com/test/package/hello/example"

//go:generate go run github.com/tiiuae/rclgo/cmd/rclgo-gen generate -d ../ros2/messages

The generator will detect the full module path for the current module example.com/test/package/hello/example and join it with the dest-path ../ros2/messages resulting message-module-prefix to be example.com/test/package/hello/ros2/messages