prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  contrib go plugin not able to recognize meta tag if meta ends with />
  The regex only recognize `<meta xxxxxxxxxxxxx >` but not `<meta xxxxxxxxxx />`.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py`
  Content:
  ```
  1 # coding=utf-8
  2 # Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
  3 # Licensed under the Apache License, Version 2.0 (see LICENSE).
  4 
  5 from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
  6                         unicode_literals, with_statement)
  7 
  8 import re
  9 
  10 import requests
  11 from pants.subsystem.subsystem import Subsystem
  12 from pants.util.memo import memoized_method
  13 
  14 from pants.contrib.go.subsystems.imported_repo import ImportedRepo
  15 
  16 
  17 class GoImportMetaTagReader(Subsystem):
  18   """Implements a reader for the <meta name="go-import"> protocol.
  19 
  20   See https://golang.org/cmd/go/#hdr-Remote_import_paths .
  21   """
  22   options_scope = 'go-import-metatag-reader'
  23 
  24   @classmethod
  25   def register_options(cls, register):
  26     super(GoImportMetaTagReader, cls).register_options(register)
  27     register('--retries', type=int, default=1, advanced=True,
  28              help='How many times to retry when fetching meta tags.')
  29 
  30   _META_IMPORT_REGEX = re.compile(r"""
  31       <meta
  32           \s+
  33           name=['"]go-import['"]
  34           \s+
  35           content=['"](?P<root>[^\s]+)\s+(?P<vcs>[^\s]+)\s+(?P<url>[^\s]+)['"]
  36           \s*
  37       >""", flags=re.VERBOSE)
  38 
  39   @classmethod
  40   def find_meta_tags(cls, page_html):
  41     """Returns the content of the meta tag if found inside of the provided HTML."""
  42 
  43     return cls._META_IMPORT_REGEX.findall(page_html)
  44 
  45   @memoized_method
  46   def get_imported_repo(self, import_path):
  47     """Looks for a go-import meta tag for the provided import_path.
  48 
  49     Returns an ImportedRepo instance with the information in the meta tag,
  50     or None if no go-import meta tag is found.
  51     """
  52     try:
  53       session = requests.session()
  54       # TODO: Support https with (optional) fallback to http, as Go does.
  55       # See https://github.com/pantsbuild/pants/issues/3503.
  56       session.mount("http://",
  57                     requests.adapters.HTTPAdapter(max_retries=self.get_options().retries))
  58       page_data = session.get('http://{import_path}?go-get=1'.format(import_path=import_path))
  59     except requests.ConnectionError:
  60       return None
  61 
  62     if not page_data:
  63       return None
  64 
  65     # Return the first match, rather than doing some kind of longest prefix search.
  66     # Hopefully no one returns multiple valid go-import meta tags.
  67     for (root, vcs, url) in self.find_meta_tags(page_data.text):
  68       if root and vcs and url:
  69         # Check to make sure returned root is an exact match to the provided import path. If it is
  70         # not then run a recursive check on the returned and return the values provided by that call.
  71         if root == import_path:
  72           return ImportedRepo(root, vcs, url)
  73         elif import_path.startswith(root):
  74           return self.get_imported_repo(root)
  75 
  76     return None
  77
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py b/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py
  --- a/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py
  +++ b/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py
  @@ -34,7 +34,7 @@
             \s+
             content=['"](?P<root>[^\s]+)\s+(?P<vcs>[^\s]+)\s+(?P<url>[^\s]+)['"]
             \s*
  -      >""", flags=re.VERBOSE)
  +      /?>""", flags=re.VERBOSE)
   
     @classmethod
     def find_meta_tags(cls, page_html):
  
verification_info: {"golden_diff": "diff --git a/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py b/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py\n--- a/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py\n+++ b/contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py\n@@ -34,7 +34,7 @@\n           \\s+\n           content=['\"](?P<root>[^\\s]+)\\s+(?P<vcs>[^\\s]+)\\s+(?P<url>[^\\s]+)['\"]\n           \\s*\n-      >\"\"\", flags=re.VERBOSE)\n+      /?>\"\"\", flags=re.VERBOSE)\n \n   @classmethod\n   def find_meta_tags(cls, page_html):\n", "issue": "contrib go plugin not able to recognize meta tag if meta ends with />\nThe regex only recognize `<meta xxxxxxxxxxxxx >` but not `<meta xxxxxxxxxx />`.\n", "before_files": [{"content": "# coding=utf-8\n# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import (absolute_import, division, generators, nested_scopes, print_function,\n                        unicode_literals, with_statement)\n\nimport re\n\nimport requests\nfrom pants.subsystem.subsystem import Subsystem\nfrom pants.util.memo import memoized_method\n\nfrom pants.contrib.go.subsystems.imported_repo import ImportedRepo\n\n\nclass GoImportMetaTagReader(Subsystem):\n  \"\"\"Implements a reader for the <meta name=\"go-import\"> protocol.\n\n  See https://golang.org/cmd/go/#hdr-Remote_import_paths .\n  \"\"\"\n  options_scope = 'go-import-metatag-reader'\n\n  @classmethod\n  def register_options(cls, register):\n    super(GoImportMetaTagReader, cls).register_options(register)\n    register('--retries', type=int, default=1, advanced=True,\n             help='How many times to retry when fetching meta tags.')\n\n  _META_IMPORT_REGEX = re.compile(r\"\"\"\n      <meta\n          \\s+\n          name=['\"]go-import['\"]\n          \\s+\n          content=['\"](?P<root>[^\\s]+)\\s+(?P<vcs>[^\\s]+)\\s+(?P<url>[^\\s]+)['\"]\n          \\s*\n      >\"\"\", flags=re.VERBOSE)\n\n  @classmethod\n  def find_meta_tags(cls, page_html):\n    \"\"\"Returns the content of the meta tag if found inside of the provided HTML.\"\"\"\n\n    return cls._META_IMPORT_REGEX.findall(page_html)\n\n  @memoized_method\n  def get_imported_repo(self, import_path):\n    \"\"\"Looks for a go-import meta tag for the provided import_path.\n\n    Returns an ImportedRepo instance with the information in the meta tag,\n    or None if no go-import meta tag is found.\n    \"\"\"\n    try:\n      session = requests.session()\n      # TODO: Support https with (optional) fallback to http, as Go does.\n      # See https://github.com/pantsbuild/pants/issues/3503.\n      session.mount(\"http://\",\n                    requests.adapters.HTTPAdapter(max_retries=self.get_options().retries))\n      page_data = session.get('http://{import_path}?go-get=1'.format(import_path=import_path))\n    except requests.ConnectionError:\n      return None\n\n    if not page_data:\n      return None\n\n    # Return the first match, rather than doing some kind of longest prefix search.\n    # Hopefully no one returns multiple valid go-import meta tags.\n    for (root, vcs, url) in self.find_meta_tags(page_data.text):\n      if root and vcs and url:\n        # Check to make sure returned root is an exact match to the provided import path. If it is\n        # not then run a recursive check on the returned and return the values provided by that call.\n        if root == import_path:\n          return ImportedRepo(root, vcs, url)\n        elif import_path.startswith(root):\n          return self.get_imported_repo(root)\n\n    return None\n", "path": "contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py"}], "after_files": [{"content": "# coding=utf-8\n# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import (absolute_import, division, generators, nested_scopes, print_function,\n                        unicode_literals, with_statement)\n\nimport re\n\nimport requests\nfrom pants.subsystem.subsystem import Subsystem\nfrom pants.util.memo import memoized_method\n\nfrom pants.contrib.go.subsystems.imported_repo import ImportedRepo\n\n\nclass GoImportMetaTagReader(Subsystem):\n  \"\"\"Implements a reader for the <meta name=\"go-import\"> protocol.\n\n  See https://golang.org/cmd/go/#hdr-Remote_import_paths .\n  \"\"\"\n  options_scope = 'go-import-metatag-reader'\n\n  @classmethod\n  def register_options(cls, register):\n    super(GoImportMetaTagReader, cls).register_options(register)\n    register('--retries', type=int, default=1, advanced=True,\n             help='How many times to retry when fetching meta tags.')\n\n  _META_IMPORT_REGEX = re.compile(r\"\"\"\n      <meta\n          \\s+\n          name=['\"]go-import['\"]\n          \\s+\n          content=['\"](?P<root>[^\\s]+)\\s+(?P<vcs>[^\\s]+)\\s+(?P<url>[^\\s]+)['\"]\n          \\s*\n      /?>\"\"\", flags=re.VERBOSE)\n\n  @classmethod\n  def find_meta_tags(cls, page_html):\n    \"\"\"Returns the content of the meta tag if found inside of the provided HTML.\"\"\"\n\n    return cls._META_IMPORT_REGEX.findall(page_html)\n\n  @memoized_method\n  def get_imported_repo(self, import_path):\n    \"\"\"Looks for a go-import meta tag for the provided import_path.\n\n    Returns an ImportedRepo instance with the information in the meta tag,\n    or None if no go-import meta tag is found.\n    \"\"\"\n    try:\n      session = requests.session()\n      # TODO: Support https with (optional) fallback to http, as Go does.\n      # See https://github.com/pantsbuild/pants/issues/3503.\n      session.mount(\"http://\",\n                    requests.adapters.HTTPAdapter(max_retries=self.get_options().retries))\n      page_data = session.get('http://{import_path}?go-get=1'.format(import_path=import_path))\n    except requests.ConnectionError:\n      return None\n\n    if not page_data:\n      return None\n\n    # Return the first match, rather than doing some kind of longest prefix search.\n    # Hopefully no one returns multiple valid go-import meta tags.\n    for (root, vcs, url) in self.find_meta_tags(page_data.text):\n      if root and vcs and url:\n        # Check to make sure returned root is an exact match to the provided import path. If it is\n        # not then run a recursive check on the returned and return the values provided by that call.\n        if root == import_path:\n          return ImportedRepo(root, vcs, url)\n        elif import_path.startswith(root):\n          return self.get_imported_repo(root)\n\n    return None\n", "path": "contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py"}]}