]> git.lizzy.rs Git - micro.git/commitdiff
Improved error parsing and use warnings for golint instead of errors
authorZachary Yedidia <zyedidia@gmail.com>
Sat, 30 Apr 2016 18:30:42 +0000 (14:30 -0400)
committerZachary Yedidia <zyedidia@gmail.com>
Thu, 5 May 2016 16:53:27 +0000 (12:53 -0400)
cmd/micro/view.go
runtime/plugins/go/go.lua

index be7ff115b9aea069240c94f9da8685a9fd81ff89..1a685407f87f66651e88a981b9a861a6db545ab8 100644 (file)
@@ -401,6 +401,7 @@ func (v *View) GutterMessage(section string, lineN int, msg string, kind int) {
        v.messages[section] = append(messages, gutterMsg)
 }
 
+// ClearGutterMessages clears all gutter messages from a given section
 func (v *View) ClearGutterMessages(section string) {
        v.messages[section] = []GutterMessage{}
 }
index 4b2fcd8eb56c99303fe58aaf666eccb53c6b5dc6..73608160b421ed479f9c6cb56890bc70fa88cc0e 100644 (file)
@@ -37,21 +37,23 @@ function go_golint()
         local line = tonumber(result[2])
         local msg = result[4]
 
-        view:GutterMessage("go-lint", line, msg, 2)
+        view:GutterMessage("go-lint", line, msg, 1)
     end
 end
 
 function go_build()
     view:ClearGutterMessages("go-build")
 
-    local handle = io.popen("go build " .. view.Buf.Path .. " 2>&1")
+    local handle = io.popen("go build -o /dev/null 2>&1")
     local lines = go_split(handle:read("*a"), "\n")
     handle:close()
 
     messenger:Message(view.Buf.Path)
     for _,line in ipairs(lines) do
-        local line, msg = string.match(line, ".+:(%d+):(.+)")
-        view:GutterMessage("go-build", tonumber(line), msg, 2)
+        if string.find(line, ".+:(%d+):(.+)") then
+            local line, msg = string.match(line, ".+:(%d+):(.+)")
+            view:GutterMessage("go-build", tonumber(line), msg, 2)
+        end
     end
 end