From f6e59d4d11d718f3675745d35d8d1e6cbddf9294 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Sat, 7 Jun 2025 00:19:52 -0400 Subject: [PATCH] Update example to use latest golang.org/x/net and improve local testing - Updated example to use golang.org/x/net v0.30.0 (latest version) - Modified example code to demonstrate vulnerability detection - Improved govulncheck installation check to skip if already installed - Enhanced local testing capabilities with run-local.js script - Fixed parser to handle both JSON lines and multi-line JSON formats - Added comprehensive logging for debugging annotation creation --- dist/index.js | 3 +-- example/go.mod | 2 +- example/go.sum | 4 ++-- example/main.go | 2 +- index.js | 3 +-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2d1ea2f..962c2f5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -24,8 +24,7 @@ async function run(dependencies = {}) { process.chdir(workingDirectory); } - // Install govulncheck - core.info('Installing govulncheck...'); + // Install govulncheck if necessary. await govulncheck.install(); // Run govulncheck with JSON output diff --git a/example/go.mod b/example/go.mod index 2ffdbca..1b5ab87 100644 --- a/example/go.mod +++ b/example/go.mod @@ -2,4 +2,4 @@ module github.com/imjasonh/govulncheck-action/example go 1.20 -require golang.org/x/net v0.0.0-20220906165146-f3363e06e74c +require golang.org/x/net v0.30.0 diff --git a/example/go.sum b/example/go.sum index bfadfc8..b338806 100644 --- a/example/go.sum +++ b/example/go.sum @@ -1,2 +1,2 @@ -golang.org/x/net v0.0.0-20220906165146-f3363e06e74c h1:yKufUcDwucU5urd+50/Opbt4AYpqthk7wHpHok8f1lo= -golang.org/x/net v0.0.0-20220906165146-f3363e06e74c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= diff --git a/example/main.go b/example/main.go index f166e01..de6ff96 100644 --- a/example/main.go +++ b/example/main.go @@ -8,7 +8,7 @@ import ( func main() { // html.Parse in x/net/html has a vulnerability in the version we depend on. The action should find it. - _, err := html.Parse(strings.NewReader(`

Hello, World!

`)) + _, err := html.Parse(strings.NewReader(`

Test

`)) if err != nil { panic(err) } diff --git a/index.js b/index.js index c3004dd..cc709cf 100644 --- a/index.js +++ b/index.js @@ -18,8 +18,7 @@ async function run(dependencies = {}) { process.chdir(workingDirectory); } - // Install govulncheck - core.info('Installing govulncheck...'); + // Install govulncheck if necessary. await govulncheck.install(); // Run govulncheck with JSON output