     (cond
      ((re-search-forward "^import ([^)]+)" nil t)
       (backward-char 2)
-      'block
-      )
+      'block)
      ((re-search-forward "\\(^import \\([^\"]+ \\)?\"[^\"]+\"\n?\\)+" nil t)
-      'single
-      )
+      'single)
      ((re-search-forward "^[[:space:]\n]*package .+?\n" nil t)
       (message "No imports found, moving point after package declaration")
-      'none
-      )
+      'none)
      (t
       (goto-char old-point)
       (message "No imports or package declaration found. Is this really a Go file?")

                   (mapcar (lambda (file)
                             (let ((sub (substring file (length pkgdir) -2)))
                               (unless (or (string-prefix-p "obj/" sub) (string-prefix-p "tool/" sub))
                                 (mapconcat 'identity (cdr (split-string sub "/")) "/")
                                 )
                               ))
                           (if (file-directory-p dir)
                               (directory-files dir t "\\.a$"))))
                 (find-lisp-find-files-internal pkgdir 'find-lisp-file-predicate-is-directory 'find-lisp-default-directory-predicate))))
     (go-root-and-paths))) 'string<))

(defun go-unused-imports-lines ()
  (let (cmd)
    (if (string-match "_test\.go$" buffer-file-truename)
        (setq cmd "go test -c")

      ;; FIXME Technically, -o /dev/null fails in quite some cases (on
      ;; Windows, when compiling from within GOPATH). Practically,
      ;; however, it has the same end result: There won't be a
      ;; compiled binary/archive, and we'll get our import errors when
      ;; there are any.
      (setq cmd "go build -o /dev/null"))
    (reverse (remove nil
                     (mapcar
                      (lambda (line)
                        (if (string-match "^\\(.+\\):\\([[:digit:]]+\\): imported and not used: \".+\"$" line)
                            (if (string= (file-truename (match-string 1 line)) (file-truename buffer-file-name))
                                (string-to-number (match-string 2 line)))))
                      (split-string (shell-command-to-string cmd) "\n"))))))

(defun go-remove-unused-imports (arg)
  "Removes all unused imports. If ARG is non-nil, unused imports

(defconst go-type-regexp "[[:word:][:multibyte:]_*]+")
(defconst go-func-regexp (concat "\\<func\\>\\s *\\(" go-identifier-regexp "\\)"))
(defconst go-func-meth-regexp (concat "\\<func\\>\\s *\\(?:(\\s *" go-identifier-regexp "\\s +" go-type-regexp "\\s *)\\s *\\)?\\(" go-identifier-regexp "\\)("))
(defconst go-builtins
  '("append" "cap"   "close"   "complex" "copy"
    "delete" "imag"  "len"     "make"    "new"
    "panic"  "print" "println" "real"    "recover")
  "All built-in functions in the Go language. Used for font locking.")

(defconst go-mode-keywords
  '("break"    "default"     "func"   "interface" "select"
    "case"     "defer"       "go"     "map"       "struct"
    "chan"     "else"        "goto"   "package"   "switch"
    "const"    "fallthrough" "if"     "range"     "type"
    "continue" "for"         "import" "return"    "var")
  "All keywords in the Go language.  Used for font locking.")

(defconst go-constants '("nil" "true" "false" "iota"))
(defconst go-type-name-regexp (concat "\\(?:[*(]\\)*\\(?:" go-identifier-regexp "\\.\\)?\\(" go-identifier-regexp "\\)"))

