Skip to content

Commit

Permalink
chore: use golang.org/x/sys over syscall
Browse files Browse the repository at this point in the history
Use `golang.org/x/sys` over deprecated `syscall` package

Signed-off-by: Noel Georgi <[email protected]>
  • Loading branch information
frezbo committed May 10, 2022
1 parent dead35b commit 00a8b53
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
5 changes: 5 additions & 0 deletions storage/iscsi-tools/iscsid-wrapper/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module iscsid-wrapper

go 1.18

require golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
2 changes: 2 additions & 0 deletions storage/iscsi-tools/iscsid-wrapper/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
"log"
"os"
"os/exec"
"syscall"

"golang.org/x/sys/unix"
)

func main() {
Expand Down Expand Up @@ -36,7 +37,7 @@ func main() {
}

log.Println("iscsid-wrapper: completed..., execing into iscsid")
if err := syscall.Exec("/usr/local/sbin/iscsid", []string{"iscsid", "-f"}, os.Environ()); err != nil {
if err := unix.Exec("/usr/local/sbin/iscsid", []string{"iscsid", "-f"}, os.Environ()); err != nil {
log.Fatalf("iscsid: error execing /usr/local/sbin/iscsid %v\n", err)
}
}
21 changes: 21 additions & 0 deletions storage/iscsi-tools/iscsid-wrapper/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: iscsid-wrapper
variant: scratch
shell: /toolchain/bin/bash
dependencies:
- stage: base
steps:
- build:
- |
export PATH=${PATH}:${TOOLCHAIN}/go/bin
cp -r /pkg/* .
CGO_ENABLED=0 go build -o iscsid-wrapper main.go
install:
- |
mkdir -p /rootfs/usr/local/sbin
cp iscsid-wrapper /rootfs/usr/local/sbin/iscsid-wrapper
finalize:
- from: /rootfs
to: /rootfs
12 changes: 2 additions & 10 deletions storage/iscsi-tools/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@ dependencies:
- stage: open-isns
- stage: open-iscsi
- stage: tgt
- stage: iscsid-wrapper
steps:
- build:
- |
cp /pkg/main.go main.go
export PATH=${PATH}:${TOOLCHAIN}/go/bin
CGO_ENABLED=0 go build -o iscsid-wrapper main.go
install:
- install:
- |
mkdir -p /rootfs/usr/local/lib/containers/{iscsid,tgtd}
cp iscsid-wrapper /rootfs/usr/local/sbin/iscsid-wrapper
sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml
Expand Down

0 comments on commit 00a8b53

Please sign in to comment.