Skip to content

Commit

Permalink
Merge pull request #42 from feloy/fix-38/map-expose
Browse files Browse the repository at this point in the history
Support EXPOSE map[80/tcp:{}] notation
  • Loading branch information
feloy authored Jan 31, 2024
2 parents 40b0a79 + 32db7bd commit 7f23fb0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/command/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ var exposeResultKey exposeResultKeyType

func (e Expose) Analyze(ctx context.Context, node *parser.Node, source utils.Source, line Line) context.Context {
str := node.Value
index := strings.IndexByte(node.Value, '/')
if strings.HasPrefix(str, "map[") && strings.HasSuffix(str, "]") {
str = str[4 : len(str)-1]
}
index := strings.IndexByte(str, '/')
if index >= 0 {
str = node.Value[0:index]
str = str[0:index]
}
var results []Result
port, err := strconv.Atoi(str)
Expand Down

0 comments on commit 7f23fb0

Please sign in to comment.