def run(self, edit):
    command = ""
    args = []
    if GoToolsSettings.get().format_backend == "gofmt":
      command = "gofmt"
      args = ["-e", "-s"]
    elif ["goimports", "both"] in GoToolsSettings.get().format_backend :
      command = "goimports"
      args = ["-e"]

    stdout, stderr, rc = ToolRunner.run(command, args, stdin=Buffers.buffer_text(self.view))

    # Clear previous syntax error marks
    self.view.erase_regions("mark")

    if rc == 2:
      # Show syntax errors and bail
      self.show_syntax_errors(stderr)
      return

    if rc != 0:
      # Ermmm...
      Logger.log("unknown gofmt error (" + str(rc) + ") stderr:\n" + stderr)
      return

    if GoToolsSettings.get().format_backend == "both":
      command = "gofmt"
      args = ["-e", "-s"]
      stdout, stderr, rc = ToolRunner.run(command, args, stdin=stdout.encode('utf-8'))

    # Clear previous syntax error marks
    self.view.erase_regions("mark")

    if rc == 2:
      # Show syntax errors and bail
      self.show_syntax_errors(stderr)
      return

    if rc != 0:
      # Ermmm...
      Logger.log("unknown gofmt error (" + str(rc) + ") stderr:\n" + stderr)
      return

    # Everything's good, hide the syntax error panel
    self.view.window().run_command("hide_panel", {"panel": "output.gotools_syntax_errors"})

    # Remember the viewport position. When replacing the buffer, Sublime likes to jitter the
    # viewport around for some reason.
    self.prev_viewport_pos = self.view.viewport_position()

    # Replace the buffer with gofmt output.
    self.view.replace(edit, sublime.Region(0, self.view.size()), stdout)

    # Restore the viewport on the main GUI thread (which is the only way this works).
    sublime.set_timeout(self.restore_viewport, 0)
dataset/ETHPy150Open ironcladlou/GoTools/gotools_format.py/GotoolsFormat.run/swapped operands of `in`