Skip to content

Commit d39c07d

Browse files
fviernausschuberth
authored andcommitted
refactor(analyzer)!: Reduce the visibility of a constant
Move the constant out of the companion object, because there is no need for it to remain there. Signed-off-by: Frank Viernau <[email protected]>
1 parent 593f6ef commit d39c07d

File tree

1 file changed

+3
-3
lines changed
  • analyzer/src/main/kotlin/managers

1 file changed

+3
-3
lines changed

analyzer/src/main/kotlin/managers/GoMod.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ class GoMod(
7272
) : PackageManager(name, analysisRoot, analyzerConfig, repoConfig), CommandLineTool {
7373
companion object {
7474
const val DEFAULT_GO_PROXY = "https://proxy.golang.org"
75-
76-
val JSON = Json { ignoreUnknownKeys = true }
7775
}
7876

7977
class Factory : AbstractPackageManagerFactory<GoMod>("GoMod") {
@@ -390,6 +388,8 @@ private const val PACKAGE_SEPARATOR = "# "
390388
*/
391389
private const val WHY_CHUNK_SIZE = 32
392390

391+
private val JSON = Json { ignoreUnknownKeys = true }
392+
393393
@Serializable
394394
private data class ModuleInfo(
395395
@SerialName("Path")
@@ -457,7 +457,7 @@ private data class ModuleInfoFile(
457457

458458
private fun ModuleInfo.toVcsInfo(): VcsInfo? {
459459
val infoFile = goMod?.let { File(it).resolveSibling("$version.info") } ?: return null
460-
val info = infoFile.inputStream().use { GoMod.JSON.decodeFromStream<ModuleInfoFile>(it) }
460+
val info = infoFile.inputStream().use { JSON.decodeFromStream<ModuleInfoFile>(it) }
461461
val type = info.origin.vcs?.let { VcsType.forName(it) }.takeIf { it == VcsType.GIT } ?: return null
462462

463463
return VcsInfo(

0 commit comments

Comments
 (0)