 
         if item[0] is '\t' and violations.length > 0
           # stuff like interfaces not being satisfied, etc will be indented
-          if not skippingIndented
+          unless skippingIndented
             violations[violations.length-1].message += '\n' + item
         else
-          [_, filePath, line, _, col, msg] = item.match(@pattern)
+          [_, filePath, line, _, col, msg] = item.match(errorPattern)
           filePath = '/' + filePath
           if filePath isnt @filePath
             skippingIndented = true

{Range, Point} = require 'atom'
CommandRunner = require '../command-runner'
Violation = require '../violation'
os = require 'os'
path = require 'path'
fs = require 'fs'

module.exports =
class GoLint
  constructor: (@filePath) ->
    @pattern = /^\/+([^:]+):(\d+)(:(\d+))?: (.*)$/
    @gotEnv = false

  run: (callback) ->
    f = () =>
      @runGoLint (error, violations) ->
        if error?
          callback(error)
        else
          callback(null, violations)

    if @gotEnv
      f()
    else
      @getEnv f

  runGoLint: (callback) ->
    runner = new CommandRunner(@buildCommand())

      "GOPATH"
      "GOCHAR"
    ])).run (error, result) =>
      unless error?
        [@GOARCH, @GOOS, @GOPATH, @GOCHAR] = result.stdout.split('\n')
        @importpath = "#{@GOPATH}/pkg/#{@GOOS}_#{@GOARCH}"
        callback()

  # Build the compile command to be run, including relevant flags and setting
  # the import path to GOPATH/pkg (the go tool *g needs to be told explicitly,
  # normally `go build` does this all for us).
  # Opting for *g instead of go build because the linking would take up
  # unnecessary real and cpu time for no gain.
  buildCommand: () ->
    # compile with all the other files in the same directory so it doesn't
    # complain about missing identifiers, etc
    here = path.dirname(@filePath)
    files = fs.readdirSync(here).filter (file) ->
      path.extname(file) is '.go'
    .map (file) ->
      path.join(here, file)

    [
      atom.config.get('atom-lint.gc.path') || 'go'
      "tool"
      @GOCHAR + 'g'
      "-L" # use full file paths
