           (list 1 (substring out 0 -1))
         (list 0 out)))))
 
+(defvar gotn-mode-map
+  (nconc (make-sparse-keymap) compilation-mode-map)
+  "Keymap for gotn major mode.")
+
+(define-derived-mode gotn-mode compilation-mode "gotn"
+  "Major mode for the gotn compilation buffer."
+  (use-local-map gotn-mode-map)
+  (setq major-mode 'gotn-mode)
+  (setq mode-name "gotn")
+  (setq-local truncate-lines t)
+  (font-lock-add-keywords nil nil))
+
 (provide 'gotn)
 
 ;;; gotn.el ends here

;; Keywords: languages go test
;; URL: https://github.com/yauhenl/gotn.el

;;; Code:

(defcustom go-test-case-command "go test -v -run"
  "The 'godef' command."
  :type 'string
  :group 'gotn)

(defun gotn-run-test (point)
  "Run go test at POINT."

  (condition-case nil
      (let ((gotn-out (gotn--call point)))
        (if (= (car gotn-out) 0)
            (gotn--run-test-as-compilation (concat go-test-case-command " ^" (car (cdr gotn-out)) "$"))
          (if go-test-package-test-fallback
              (gotn--run-test-as-compilation go-test-package-command)
            (message (format "Could not run gotn binary: %s" (cdr gotn-out))))))))

(defun gotn--call (point)
  "Call `gotn' to get test name at POINT."
