From 2046cf89d01bc60bc65b1f9d016ce7fe715e7b90 Mon Sep 17 00:00:00 2001 From: Brad Clawsie Date: Thu, 29 Jul 2021 20:02:04 -0500 Subject: [PATCH] align PR with perlcritic --- Changelog | 4 ++++ lib/Lang/Go/Mod.pm | 9 +++++---- t/samples/01/go.mod | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index c6e70f3..450cb29 100644 --- a/Changelog +++ b/Changelog @@ -6,3 +6,7 @@ 0.003 2021-07-29 - Add some metadata for metacpan + +0.004 2021-07-29 +- Merge https://github.com/bradclawsie/Lang-Go-Mod/pull/1 for + comment processing diff --git a/lib/Lang/Go/Mod.pm b/lib/Lang/Go/Mod.pm index 68bea46..6ded690 100644 --- a/lib/Lang/Go/Mod.pm +++ b/lib/Lang/Go/Mod.pm @@ -13,7 +13,7 @@ use Path::Tiny qw(path); # ABSTRACT: parse and model go.mod files -our $VERSION = '0.003'; +our $VERSION = '0.004'; our $AUTHORITY = 'cpan:bclawsie'; our @EXPORT_OK = qw(read_go_mod parse_go_mod); @@ -121,11 +121,11 @@ sub parse_go_mod { if ( defined $m->{'require'}->{$1} ); $m->{'require'}->{$1} = $2; } - elsif ( $line =~ m!^\s*//.*$! ) { + elsif ( $line =~ m{^\s*//.*$}mx ) { - # comment + # comment - } + } else { croak "unknown line content: $line"; } @@ -150,6 +150,7 @@ C - parse and model go.mod files # $ cat go.mod # module github.com/example/my-project # go 1.16 + # // comments # exclude ( # example.com/whatmodule v1.4.0 # ) diff --git a/t/samples/01/go.mod b/t/samples/01/go.mod index fec3833..6291cce 100644 --- a/t/samples/01/go.mod +++ b/t/samples/01/go.mod @@ -2,6 +2,8 @@ module github.com/example/my-project go 1.16 +// these are comments + exclude ( example.com/whatmodule v1.4.0 ) -- 2.45.2