We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 87451a0 commit 1381c01Copy full SHA for 1381c01
gradle-modules/src/main/kotlin/org/sonarsource/cloudnative/gradle/GoBuild.kt
@@ -16,6 +16,7 @@
16
*/
17
package org.sonarsource.cloudnative.gradle
18
19
+import java.io.File
20
import org.gradle.api.Project
21
import org.gradle.api.file.FileTree
22
import org.gradle.api.file.RegularFile
@@ -72,3 +73,14 @@ fun Project.goSources(): FileTree =
72
73
include("**/*.go")
74
exclude("build/**", "**/*_generated.go")
75
}
76
+
77
+fun convertLicenseHeaderToGoCommentStyle(inputFile: File): String {
78
+ val lines = inputFile.readLines()
79
80
+ if (lines.size <= 2) return ""
81
82
+ // drop(1) removes the first, dropLast(1) removes the last
83
+ return lines.drop(1).dropLast(1).joinToString("\n") { line ->
84
+ line.replace(" *", "//")
85
+ }
86
+}
0 commit comments