# Test no vulnerabilities in main module with devel version.
$ govulncheck -format json -mode=binary ${moddir}/vuln/vuln_main_devel
{
  "config": {
    "protocol_version": "v1.0.0",
    "scanner_name": "govulncheck",
    "scanner_version": "v0.0.0-00000000000-20000101010101",
    "db": "testdata/vulndb-v1",
    "db_last_modified": "2023-04-03T15:57:51Z",
    "scan_level": "symbol",
    "scan_mode": "binary"
  }
}
{
  "progress": {
    "message": "Scanning your binary for known vulnerabilities..."
  }
}
{
  "progress": {
    "message": "Fetching vulnerabilities from the database..."
  }
}
{
  "progress": {
    "message": "Checking the binary against the vulnerabilities..."
  }
}
{
  "SBOM": {
    "go_version": "go1.18",
    "modules": [
      {
        "path": "golang.org/vuln",
        "version": "(devel)"
      },
      {
        "path": "stdlib",
        "version": "v1.18.0"
      }
    ],
    "roots": [
      "golang.org/vuln"
    ]
  }
}
{
  "osv": {
    "schema_version": "1.3.1",
    "id": "GO-9999-9999",
    "modified": "2023-04-03T15:57:51Z",
    "published": "2021-04-14T20:04:52Z",
    "aliases": [
      "CVE-9999-99999",
      "GHSA-9999-9999-9999"
    ],
    "summary": "A fake vulnerability in golang.org/x/vuln",
    "details": "This is a fake vulnerability used only for testing purposes.",
    "affected": [
      {
        "package": {
          "name": "golang.org/vuln",
          "ecosystem": "Go"
        },
        "ranges": [
          {
            "type": "SEMVER",
            "events": [
              {
                "introduced": "0"
              },
              {
                "fixed": "0.3.3"
              }
            ]
          }
        ],
        "ecosystem_specific": {
          "imports": [
            {
              "path": "golang.org/vuln",
              "symbols": [
                "main"
              ]
            }
          ]
        }
      }
    ],
    "database_specific": {
      "url": "https://pkg.go.dev/vuln/GO-9999-9999"
    }
  }
}

# Test vulnerabilities in main module with v0.3.1 version.
$ govulncheck -format json -mode=binary ${moddir}/vuln/vuln_main_v0.3.1
{
  "config": {
    "protocol_version": "v1.0.0",
    "scanner_name": "govulncheck",
    "scanner_version": "v0.0.0-00000000000-20000101010101",
    "db": "testdata/vulndb-v1",
    "db_last_modified": "2023-04-03T15:57:51Z",
    "scan_level": "symbol",
    "scan_mode": "binary"
  }
}
{
  "progress": {
    "message": "Scanning your binary for known vulnerabilities..."
  }
}
{
  "progress": {
    "message": "Fetching vulnerabilities from the database..."
  }
}
{
  "progress": {
    "message": "Checking the binary against the vulnerabilities..."
  }
}
{
  "SBOM": {
    "go_version": "go1.18",
    "modules": [
      {
        "path": "golang.org/vuln",
        "version": "v0.3.1"
      },
      {
        "path": "stdlib",
        "version": "v1.18.0"
      }
    ],
    "roots": [
      "golang.org/vuln"
    ]
  }
}
{
  "osv": {
    "schema_version": "1.3.1",
    "id": "GO-9999-9999",
    "modified": "2023-04-03T15:57:51Z",
    "published": "2021-04-14T20:04:52Z",
    "aliases": [
      "CVE-9999-99999",
      "GHSA-9999-9999-9999"
    ],
    "summary": "A fake vulnerability in golang.org/x/vuln",
    "details": "This is a fake vulnerability used only for testing purposes.",
    "affected": [
      {
        "package": {
          "name": "golang.org/vuln",
          "ecosystem": "Go"
        },
        "ranges": [
          {
            "type": "SEMVER",
            "events": [
              {
                "introduced": "0"
              },
              {
                "fixed": "0.3.3"
              }
            ]
          }
        ],
        "ecosystem_specific": {
          "imports": [
            {
              "path": "golang.org/vuln",
              "symbols": [
                "main"
              ]
            }
          ]
        }
      }
    ],
    "database_specific": {
      "url": "https://pkg.go.dev/vuln/GO-9999-9999"
    }
  }
}
{
  "finding": {
    "osv": "GO-9999-9999",
    "fixed_version": "v0.3.3",
    "trace": [
      {
        "module": "golang.org/vuln",
        "version": "v0.3.1"
      }
    ]
  }
}
{
  "finding": {
    "osv": "GO-9999-9999",
    "fixed_version": "v0.3.3",
    "trace": [
      {
        "module": "golang.org/vuln",
        "version": "v0.3.1",
        "package": "golang.org/vuln"
      }
    ]
  }
}
{
  "finding": {
    "osv": "GO-9999-9999",
    "fixed_version": "v0.3.3",
    "trace": [
      {
        "module": "golang.org/vuln",
        "version": "v0.3.1",
        "package": "golang.org/vuln",
        "function": "main"
      }
    ]
  }
}
