code: def execute_go_cmd(self, cmd, gopath=None, args=None, env=None,
                       workunit_factory=None, workunit_name=None, workunit_labels=None, **kwargs):
      
      go_cmd = self.create_go_cmd(cmd, gopath=gopath, args=args)
      if workunit_factory is None:
        return go_cmd.spawn(**kwargs).wait()
      else:
        name = workunit_name or cmd
        labels = [WorkUnitLabel.TOOL] + (workunit_labels or [])
        with workunit_factory(name=name, labels=labels, cmd=str(go_cmd)) as workunit:
          process = go_cmd.spawn(env=env,
                                 stdout=workunit.output('stdout'),
                                 stderr=workunit.output('stderr'),
                                 **kwargs)
          returncode = process.wait()
          workunit.set_outcome(WorkUnit.SUCCESS if returncode == 0 else WorkUnit.FAILURE)
          return returncode, go_cmd
docs: Runs a Go command that is optionally targeted to a Go workspace.
  
      If a `workunit_factory` is supplied the command will run in a work unit context.
  
      :param string cmd: Go command to execute, e.g. 'test' for `go test`
      :param string gopath: An optional $GOPATH which points to a valid Go workspace from which to run
                            the command.
      :param list args: An optional list of arguments and flags to pass to the Go command.
      :param dict env: A custom environment to launch the Go command in.  If `None` the current
                       environment is used.
      :param workunit_factory: An optional callable that can produce a `WorkUnit` context
      :param string workunit_name: An optional name for the work unit; defaults to the `cmd`
      :param list workunit_labels: An optional sequence of labels for the work unit.
      :param kwargs: Keyword arguments to pass through to `subprocess.Popen`.
      :returns: A tuple of the exit code and the go command that was run.
      :rtype: (int, :class:`GoDistribution.GoCommand`)