Skip to content

Commit

Permalink
build: Avoid cross compilation issue on Windows
Browse files Browse the repository at this point in the history
Happens in cilium-cli PR when trying to import the latest cilium/cilium
main hash. This commit is to perform the following:

- Remove unix.SIGINT as it's same as os.Interrupt
- Replace unix.SIGTERM by syscall.SIGTERM for cross compilation

```
Error: vendor/github.com/cilium/cilium/pkg/hive/hive.go:202:44: undefined: unix.SIGINT
Error: vendor/github.com/cilium/cilium/pkg/hive/hive.go:202:57: undefined: unix.SIGTERM
Error: Process completed with exit code 1.
```

Signed-off-by: Tam Mach <tam.mach@cilium.io>
  • Loading branch information
sayboras committed Jun 6, 2023
1 parent 6d4b2f7 commit 2ee4320
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/hive/hive.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
"os/signal"
"reflect"
"strings"
"syscall"
"time"

"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"go.uber.org/dig"
"go.uber.org/multierr"
"golang.org/x/sys/unix"

"github.com/cilium/cilium/pkg/hive/cell"
"github.com/cilium/cilium/pkg/logging"
Expand Down Expand Up @@ -213,7 +213,7 @@ func (h *Hive) Run() error {
func (h *Hive) waitForSignalOrShutdown() error {
signals := make(chan os.Signal, 1)
defer signal.Stop(signals)
signal.Notify(signals, os.Interrupt, unix.SIGINT, unix.SIGTERM)
signal.Notify(signals, os.Interrupt, syscall.SIGTERM)
select {
case sig := <-signals:
log.WithField("signal", sig).Info("Signal received")
Expand Down

0 comments on commit 2ee4320

Please sign in to comment.