         whichStub.which.restore()
         HooksWorkerClient.prototype.terminateHandler.restore()
         process.env.GOBIN = goBin
+        process.env.GOPATH = goPath
 
       it 'should spawn the server process with command "$GOBIN/goodman"', (done) ->
         loadWorkerClient (err) ->

          assert.include err.message, "composer require ddelnano/dredd-hooks-php --dev"
          done()

    describe 'when --language=go option is given and go is not installed', ->
      beforeEach ->
        runner.hooks['configuration'] =
          options:
            language: 'go'
            hookfiles: 'gobinary'

      it 'should write an error', (done) ->
        loadWorkerClient (err) ->
          assert.isOk err
          assert.include err.message, "Go doesn't seem to be installed"
          done()

    describe 'when --language=go option is given and the worker is not installed', ->
      goBin = undefined
      beforeEach ->
        goBin = process.env.GOBIN
        process.env.GOBIN = '/dummy/gobin/path'
        sinon.stub(whichStub, 'which').callsFake (command) -> false

        runner.hooks['configuration'] =
          options:
            language: 'go'
            hookfiles: 'gobinary'
      afterEach ->
        whichStub.which.restore()
        process.env.GOBIN = goBin

      it 'should write a hint how to install', (done) ->
        loadWorkerClient (err) ->

net = require 'net'
{assert} = require 'chai'
clone = require 'clone'
childProcess = require('child_process')

crossSpawnStub = require('cross-spawn')
whichStub = require('../../src/which')
