Skip to content

Commit

Permalink
refactor(lib): Reuse 'statement' variable
Browse files Browse the repository at this point in the history
  • Loading branch information
pan93412 committed Sep 25, 2023
1 parent 475d5fc commit 51e6f3f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/zeaburpack/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ type FromStatement struct {

// ParseFrom parses a FROM statement from a Dockerfile line.
func ParseFrom(line string) (FromStatement, bool) {
statement := FromStatement{}

names := fromStatementRegex.SubexpNames()
submatch := fromStatementRegex.FindStringSubmatch(line)
if len(submatch) == 0 {
return FromStatement{}, false
return statement, false
}

statement := FromStatement{}
for i, name := range names {
switch name {
case "src":
Expand Down

0 comments on commit 51e6f3f

Please sign in to comment.