         ;; Inside a multi-line string.  Don't mess with indentation.
         nil)
        (cs
-        ;; Inside a multi-line comment
+        ;; Inside a general comment
         (goto-char (car cs))
         (forward-char 1)
         (current-column))
-       ((not (go-mode-nesting))
-        ;; Top-level
-        (if (or (eolp)
-                (looking-at "\\<\\(import\\|package\\|const\\|var\\|type\\|func\\)\\>")
-                (looking-at "//\\|/\\*"))
-            0
-          ;; Continuation line
-          ;; XXX If you start typing a new continuation line, nothing
-          ;; will cause it to be indented.
-          tab-width))
        (t
-        ;; Neither top-level nor in a multi-line string or comment
+        ;; Not in a multi-line string or comment
         (let ((indent 0)
-              (inside-indenting-paren nil)
-              (current-line-closes-scope nil))
+              (inside-indenting-paren nil))
           ;; Count every enclosing brace, plus parens that follow
           ;; import, const, var, or type and indent according to
           ;; depth.  This simple rule does quite well, but also has a

    st)
  "Syntax table for Go mode.")

(defvar go-mode-font-lock-keywords
  (let ((keywords '("import" "package"
                    "var" "const" "type" "func"
                    "struct" "interface"
                    "chan" "map"
                    "if" "else" "for" "switch" "select"
                    "range" "case" "default"
                    "return" "continue" "break" "fallthrough" "goto"
                    "go" "defer"))
        (builtins '("cap" "close" "closed" "len" "make" "new"
                    "panic" "panicln" "print" "println"))
        (constants '("nil" "true" "false" "iota"))
        (type-name "\\s *\\(?:[*(]\\s *\\)*\\(?:\\w+\\s *\\.\\s *\\)?\\(\\w+\\)")
        )
    `((,(regexp-opt keywords 'words) . font-lock-keyword-face)
      (,(regexp-opt builtins 'words) . font-lock-builtin-face)
      (,(regexp-opt constants 'words) . font-lock-constant-face)
      ;; Function names in declarations

;; 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.

