Skip to content

Commit

Permalink
refactor(analyzer)!: Reduce the visibility of a constant
Browse files Browse the repository at this point in the history
Move the constant out of the companion object, because there is no need
for it to remain there.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau authored and sschuberth committed Oct 30, 2023
1 parent 593f6ef commit d39c07d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions analyzer/src/main/kotlin/managers/GoMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class GoMod(
) : PackageManager(name, analysisRoot, analyzerConfig, repoConfig), CommandLineTool {
companion object {
const val DEFAULT_GO_PROXY = "https://proxy.golang.org"

val JSON = Json { ignoreUnknownKeys = true }
}

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

private val JSON = Json { ignoreUnknownKeys = true }

@Serializable
private data class ModuleInfo(
@SerialName("Path")
Expand Down Expand Up @@ -457,7 +457,7 @@ private data class ModuleInfoFile(

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

return VcsInfo(
Expand Down

0 comments on commit d39c07d

Please sign in to comment.