From 5f2246e3c526fbf853adc839e6ab87cf3f5e0225 Mon Sep 17 00:00:00 2001
From: Danny McCormick <damccorm@microsoft.com>
Date: Thu, 20 Jun 2019 13:51:56 -0400
Subject: [PATCH] Add problem matcher

---
 .github/go.json | 16 ++++++++++++++++
 README.md       |  2 +-
 lib/setup-go.js |  8 +++++---
 src/setup-go.ts |  9 ++++++---
 4 files changed, 28 insertions(+), 7 deletions(-)
 create mode 100644 .github/go.json

diff --git a/.github/go.json b/.github/go.json
new file mode 100644
index 0000000..f370917
--- /dev/null
+++ b/.github/go.json
@@ -0,0 +1,16 @@
+{
+    "problemMatcher": [
+        {
+            "owner": "go",
+            "pattern": [
+                {
+                    "regexp": "^([^:]*: )?((.:)?[^:]*):(\\d+)(:(\\d+))?: (.*)$",
+                    "file": 2,
+                    "line": 4,
+                    "column": 6,
+                    "message": 7
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 404822b..4aea0b0 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
 This action sets by Go environment for use in actions by:
 
 - optionally downloading and caching a version of Go
-- TODO: registering problem matchers for error output 
+- registering problem matchers for error output 
 - TODO: configuring proxy if the runner is configured to use a proxy (coming with private runners)
 
 # License
diff --git a/lib/setup-go.js b/lib/setup-go.js
index e777d3a..fa24b36 100644
--- a/lib/setup-go.js
+++ b/lib/setup-go.js
@@ -16,7 +16,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const core = __importStar(require("@actions/core"));
-// import * as installer from './installer';
+const installer = __importStar(require("./installer"));
+const path = __importStar(require("path"));
 function run() {
     return __awaiter(this, void 0, void 0, function* () {
         try {
@@ -26,10 +27,11 @@ function run() {
             //
             const version = core.getInput('version');
             if (version) {
-                // await installer.getGo(version);
+                yield installer.getGo(version);
             }
             // TODO: setup proxy from runner proxy config
-            // TODO: problem matchers registered
+            const matchersPath = path.join(__dirname, '..', '.github');
+            console.log(`##[add-matcher]${path.join(matchersPath, 'go.json')}`);
         }
         catch (error) {
             core.setFailed(error.message);
diff --git a/src/setup-go.ts b/src/setup-go.ts
index b267d89..d8b2225 100644
--- a/src/setup-go.ts
+++ b/src/setup-go.ts
@@ -1,5 +1,6 @@
 import * as core from '@actions/core';
-// import * as installer from './installer';
+import * as installer from './installer';
+import * as path from 'path';
 
 async function run() {
   try {
@@ -9,11 +10,13 @@ async function run() {
     //
     const version = core.getInput('version');
     if (version) {
-      // await installer.getGo(version);
+      await installer.getGo(version);
     }
 
     // TODO: setup proxy from runner proxy config
-    // TODO: problem matchers registered
+
+    const matchersPath = path.join(__dirname, '..', '.github');
+    console.log(`##[add-matcher]${path.join(matchersPath, 'go.json')}`);
   } catch (error) {
     core.setFailed(error.message);
   }