Skip to content

Commit 337aa07

Browse files
committed
Change signature to be more structured
1 parent ecd8708 commit 337aa07

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

go/porcelain/deploy.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type DeployObserver interface {
6363
}
6464

6565
type DeployWarner interface {
66-
OnWalkWarning(string)
66+
OnWalkWarning(path, msg string)
6767
}
6868

6969
// DeployOptions holds the option for creating a new deploy
@@ -591,9 +591,7 @@ func bundle(functionDir string, observer DeployObserver) (*deployFiles, error) {
591591
functions.Add(file.Name, file)
592592
default:
593593
if warner, ok := observer.(DeployWarner); ok {
594-
warner.OnWalkWarning(
595-
fmt.Sprintf("Function \"%s\" is not valid for deployment. Please check that it matches the format for the runtime.", filePath),
596-
)
594+
warner.OnWalkWarning(filePath, "Function is not valid for deployment. Please check that it matches the format for the runtime.")
597595
}
598596
}
599597
}
@@ -668,22 +666,22 @@ func goFile(filePath string, i os.FileInfo, observer DeployObserver) bool {
668666

669667
if m := i.Mode(); m&0111 == 0 { // check if it's an executable file
670668
if hasWarner {
671-
warner.OnWalkWarning(fmt.Sprintf("%s: Go binary does not have executable permissions", filePath))
669+
warner.OnWalkWarning(filePath, "Go binary does not have executable permissions")
672670
}
673671
return false
674672
}
675673

676674
if _, err := elf.Open(filePath); err != nil { // check if it's a linux executable
677675
if hasWarner {
678-
warner.OnWalkWarning(fmt.Sprintf("%s: Go binary is not a linux executable", filePath))
676+
warner.OnWalkWarning(filePath, "Go binary is not a linux executable")
679677
}
680678
return false
681679
}
682680

683681
v, err := version.ReadExe(filePath)
684682
if err != nil || !strings.HasPrefix(v.Release, "go1.") {
685683
if hasWarner {
686-
warner.OnWalkWarning(fmt.Sprintf("%s: Unable to detect Go version 1.x", filePath))
684+
warner.OnWalkWarning(filePath, "Unable to detect Go version 1.x")
687685
}
688686
}
689687

0 commit comments

Comments
 (0)