                      (and depth
                           (not (eq (char-after (caar depth)) ?\{)))))
                   (t
-                   ;; Except when the current line closes the previous line's 
-                   ;; scope, anything else is a continuation line.
-                   (not current-line-closes-scope)))
+                   ;; We're in the middle of a block.  Did the
+                   ;; previous line end with an implicit or explicit
+                   ;; semicolon?
+                   (not (go-mode-semicolon-p))))
             (incf indent tab-width))
+
           (max indent 0)))))))
 
 (defun go-mode-indent-line ()

                       (setq inside-indenting-paren t)))))
                (setq first nil))))

          (setq current-line-closes-scope
                (case (char-after)
                  ((?\} ?\)) t)
                  (t nil)))

          ;; case, default, and labels are outdented 1 level
          (when (looking-at "\\<case\\>\\|\\<default\\>\\|\\w+\\s *:\\(\\S.\\|$\\)")
            (decf indent tab-width)
            ;; Lines with case, default, etc. also "close" the previous line's 
            ;; scope, even when there is no semicolon. Don't treat them as
            ;; continuation lines.
            (setq current-line-closes-scope t))

          ;; Continuation lines are indented 1 level
          (forward-comment (- (buffer-size)))
          (when (case (char-before)
                  ((?\{ ?\} ?\; ?:)
                   ;; Not a continuation line
                   nil)
                  ((?\()
                   ;; Usually a continuation line, unless this paren
                   ;; counted towards our indentation already
                   (not inside-indenting-paren))
                  ((?,)
                   ;; Could be inside a literal.  We're a little

;; Indentation
;;

(defvar go-mode-non-terminating-keywords-regexp
  (let* ((kws go-mode-keywords)
         (kws (remove "break" kws))
         (kws (remove "continue" kws))
         (kws (remove "fallthrough" kws))
         (kws (remove "return" kws)))
    (regexp-opt kws 'words))
  "Regular expression matching all Go keywords that *do not*
implicitly terminate a statement.")

(defun go-mode-semicolon-p ()
  "True iff point immediately follows either an explicit or
implicit semicolon.  Point should immediately follow the last
token on the line."

  ;; #Semicolons
  (case (char-before)
    ((?\;) t)
    ;; String literal
    ((?' ?\" ?`) t)
    ;; One of the operators and delimiters ++, --, ), ], or }
    ((?+) (eq (char-before (1- (point))) ?+))
    ((?-) (eq (char-before (1- (point))) ?-))
    ((?\) ?\] ?\}) t)
    ;; An identifier or one of the keywords break, continue,
    ;; fallthrough, or return or a numeric literal
    (otherwise
     (save-excursion
       (when (/= (skip-chars-backward "[:word:]_") 0)
         (not (looking-at go-mode-non-terminating-keywords-regexp)))))))

(defun go-mode-indentation ()
  "Compute the ideal indentation level of the current line.

