From c933cfd4f6a7c9d158f8aac33bb54343ab3985f2 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 3 Nov 2022 17:33:02 +0100 Subject: [PATCH 1/5] feat: disable watcher on aix Signed-off-by: Mark Sagi-Kazar --- watch.go | 4 ++-- watch_wasm.go => watch_disabled.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) rename watch_wasm.go => watch_disabled.go (91%) diff --git a/watch.go b/watch.go index b5523b8f9..3a2fe8cc7 100644 --- a/watch.go +++ b/watch.go @@ -1,5 +1,5 @@ -//go:build !js -// +build !js +//go:build !js && !aix +// +build !js,!aix package viper diff --git a/watch_wasm.go b/watch_disabled.go similarity index 91% rename from watch_wasm.go rename to watch_disabled.go index 8e47e6a91..deebb0e5b 100644 --- a/watch_wasm.go +++ b/watch_disabled.go @@ -1,4 +1,5 @@ -// +build js,wasm +//go:build js || aix +// +build js aix package viper From c9f48234232a19bfdaf4b5cbeae8d39fd23552de Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 3 Nov 2022 18:16:10 +0100 Subject: [PATCH 2/5] ci: add build for aix Signed-off-by: Mark Sagi-Kazar --- .github/workflows/ci.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6582fe73e..4bcdcde0b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,6 +7,33 @@ on: pull_request: jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - goos: js + goarch: wasm + - goos: aix + goarch: ppc64 + + steps: + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build + run: go build . + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + test: name: Test runs-on: ${{ matrix.os }} From 7f21bc7bad55419f93457504486b3121a6010044 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 3 Nov 2022 18:17:50 +0100 Subject: [PATCH 3/5] ci: drop dedicated wasm build Signed-off-by: Mark Sagi-Kazar --- .github/workflows/wasm.yaml | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .github/workflows/wasm.yaml diff --git a/.github/workflows/wasm.yaml b/.github/workflows/wasm.yaml deleted file mode 100644 index 82da1d50a..000000000 --- a/.github/workflows/wasm.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: WASM - -on: - push: - branches: - - master - pull_request: - -jobs: - build: - name: Build - runs-on: ubuntu-latest - env: - GOFLAGS: -mod=readonly - - steps: - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: '1.17' - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Ensure Viper compiles for WASM - run: GOOS=js GOARCH=wasm go build . From ec606613b24eb4c6080e8986589d6a64e3cf306c Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 3 Nov 2022 20:21:21 +0100 Subject: [PATCH 4/5] feat: fix compilation for all platforms unsupported by fsnotify Signed-off-by: Mark Sagi-Kazar --- watch.go | 4 ++-- watch_disabled.go | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/watch.go b/watch.go index 3a2fe8cc7..1ce84eaf8 100644 --- a/watch.go +++ b/watch.go @@ -1,5 +1,5 @@ -//go:build !js && !aix -// +build !js,!aix +//go:build darwin || dragonfly || freebsd || openbsd || linux || netbsd || solaris || windows +// +build darwin dragonfly freebsd openbsd linux netbsd solaris windows package viper diff --git a/watch_disabled.go b/watch_disabled.go index deebb0e5b..dbf74ef37 100644 --- a/watch_disabled.go +++ b/watch_disabled.go @@ -1,14 +1,19 @@ -//go:build js || aix -// +build js aix +//go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows +// +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows package viper import ( - "errors" + "fmt" + "runtime" "github.com/fsnotify/fsnotify" ) +func newWatcher() (*watcher, error) { + return &watcher{}, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS) +} + type watcher struct { Events chan fsnotify.Event Errors chan error @@ -25,7 +30,3 @@ func (*watcher) Add(name string) error { func (*watcher) Remove(name string) error { return nil } - -func newWatcher() (*watcher, error) { - return &watcher{}, errors.New("fsnotify is not supported on WASM") -} From 8c947013284f71c08b9f7eafb9c12b51a818c590 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 3 Nov 2022 20:22:00 +0100 Subject: [PATCH 5/5] refactor: rename watch file to unsupported Signed-off-by: Mark Sagi-Kazar --- watch_disabled.go => watch_unsupported.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename watch_disabled.go => watch_unsupported.go (100%) diff --git a/watch_disabled.go b/watch_unsupported.go similarity index 100% rename from watch_disabled.go rename to watch_unsupported.go