You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/04/20 00:58:59 UTC
[GitHub] ccollins476ad commented on a change in pull request #161: cmake:
Use paths relative to project root
ccollins476ad commented on a change in pull request #161: cmake: Use paths relative to project root
URL: https://github.com/apache/mynewt-newt/pull/161#discussion_r182923154
##########
File path: newt/builder/cmake.go
##########
@@ -46,6 +47,19 @@ func EscapeName(name string) string {
return strings.Replace(name, "/", "_", -1)
}
+func trimProjectPath(path string) string {
+ proj := interfaces.GetProject()
+ path = strings.TrimPrefix(path, proj.Path()+"/")
+ return path
+}
+
+func trimProjectPathSlice(elements []string) []string {
+ for e := range elements {
+ elements[e] = trimProjectPath(elements[e])
Review comment:
I would be a bit careful with this. In Go, slices are passed by reference, so this line is actually modifying the slice that the caller passed in. It might be better to do one of the following:
1. Return a new slice containing the trimmed elements, or
2. Change the function type such that it doesn't return anything.
From the function type, a user might assume the function doesn't modify his original element slice.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services