Skip to content

Commit

Permalink
generator: use filepath.IsAbs to check for absolute paths
Browse files Browse the repository at this point in the history
The implementation of filepath.IsAbs also checks for a string prefix
so this doesn't entail any functional changes but seems a bit cleaner
IMHO.
  • Loading branch information
nmeum authored and anatol committed Apr 13, 2022
1 parent bba2f3c commit ecd29d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"net"
"os"
"strings"
"path/filepath"
"time"

"github.com/cavaliergopher/cpio"
Expand Down Expand Up @@ -247,7 +247,7 @@ func (img *Image) appendInitBinary(initBinary string) error {

func (img *Image) appendExtraFiles(binaries []string) error {
for _, f := range binaries {
if !strings.HasPrefix(f, "/") {
if !filepath.IsAbs(f) {
// simple names like "strace" are resolved as binaries under /usr/bin
f = "/usr/bin/" + f
}
Expand Down

0 comments on commit ecd29d7

Please sign in to comment.